Once again I am in your Debt Scott.   Thank you thank you,



-----Original Message-----
From: Scott Klement [mailto:klemscot@klements.com]
Sent: Wednesday, February 20, 2002 3:12 PM
To: 'midrange-l'
Subject: Re: SSL Socket Client



Hi Chris,

> What is currently eluding me is a constant defined as:
> #define SSL_ENCRYPT_MASK  (1<<0)
>
> Ok I know it is a constant but what value does (1<<0) return?

Short answer:  1

Long answer:

The << operator shifts the bits to the left.  x<<y would shift the bits
in x to the left y positions.

IBM documents this here:
http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/qb3at602/5.6.6

If for example, you had "1<<2" it would look like this (in binary):

        before shifting: 00000001
         after shifting: 00000100

The closest approximation to this in RPG is to just multiply by 2 for
each position you want to shift.   Thus   "z = x<<y" in RPG would be
"eval    z = x * (2 ** y)".

Now... in YOUR CASE, you have 1<<0.  Stick that in our equasion.
z = 1 * (2 ** 0).   Ummm...  z = 1.   Shifting it zero positions does
not change the value!  (except possibly rounding, if there are precision
issues)

So, in RPG you'd define it as:

     D SSL_ENCRYPT_MASK...
     D                 C                   CONST(1)



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.