|
|
 |
Re: FN-FORUM the operator >>
date posted 15th January 2002 17:40
> is shift right, | is bitwise OR, & is bitwise
AND and ~ is bitwise NOT.
The most common use for these operators is to allow you to isolate bitfields.
For instance if you want to take the top three bits of an eight-bit quantity
x you can do it with (x >> 5) & 7;
The x >> 5 shifts right by five bits then the & 7 masks off the bottom three
bits of the result.
You could replace the same three bits of x with y as follows:
x = ((x & 0x1f) | ((y & 7) hi there,
> i don't know where to ask this question in java newsgroups and i hope
> this mailing list will help. i'm a java newbie and have frequently
> come across codes like this: int r=(colorval >> 16) &
> 0xff;
> int g=(colorval >> 8) & 0xff;
> int b= colorval & 0xff;
> can anybody here explain how this operator work?
> marcoSend and receive Hotmail on your mobile
> device: Click
> Here
>
> ============================================================
>
> * Free listing for freelancers
> * Free to advertise jobs
> * Free jobs distribution service
> * Free database of 5000 freelancers
>
> Freelancers and Freelance Jobs:
> http://www.freelancers.net
>
> Forum FAQs:
> http://freelancers.netrickery.com
>
> To unsubscribe please email:
> [EMAIL REMOVED]
>
> If you have difficulties unsubscribing please email:
> [EMAIL REMOVED]
|
 |
|