|
-
Sep 18th, 2009, 10:00 AM
#11
Re: Bits, Bytes and Boomerangs (without the boomerangs...)
I think its in this case easier to stay in unsigned integers. The calculations for setting values over 2 bytes becomes easier. So why not using an array of UShort's
For setting a bit (set to 1) just use:
OrgVar = OrgVar OR bitweight (1,2,4,8,etc)
For reading if a bit is set:
TestVar = OrgVar AND bitweight (1,2,4,8,etc)
Test if TestVar > 0
Bitshifter are handy for setting or reading bits in a loop. But in this case I think you will not need it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|