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:

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

So, in RPG you'd define it as:

     D                 C                   CONST(1)

This thread ...

Return to Archive home page | Return to MIDRANGE.COM home page