|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
hi,
I've a byte value of 15... i wan to get it's representation a follows 0x01 | 0x02|0x03|0x04 basically i want to know by OR ing which numbers,..am I getting a value of 15... help me out.. AVL <A**@discussions.microsoft.com> wrote:
> I've a byte value of 15... Do you mean> i wan to get it's representation a follows > 0x01 | 0x02|0x03|0x04 > > basically i want to know by OR ing which numbers,..am I getting a value of > 15... 0x01 | 0x02 | 0x04 | 0x08? If so, you basically want to test a bit at a time, which is easy to do with a for loop - start with 1, test whether that bit is set using if ((value & mask) != o) and then shift the mask left one bit. Lather, rinse, repeat. -- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet If replying to the group, please do not mail me too
Other interesting topics
Learning & Frustration.
Most popular object persistence framework Monitor printers Using cacheing?? Merging Visual Studio & SDK Help custom serialization..need help Concurrency violation: the UpdateCommand affected 0 of the expecte Right Click Context Menu of a C# windows application not working o need xml help datagridview help |
|||||||||||||||||||||||