|
Re: Extracting Individual bits in C
Quote:
|
Originally Posted by Mike Soukup
The original macro is correct, you're just not used to thinking like a computer person; when counting, always start with 0. Bit 0 is the least significant and bit 7 is the most.
Also, GETBIT cannot return 2 or 5, it can only return 0 or 1 since 'AND'ing anything with 1 will get rid of all but the least significant bit.
|
oops, I missed the signifigance of the parenthases around the shift operation... You're right! It should work as you wrote it.
__________________
"It's broken? NOOAAHH!!! This is your doing, isn't it!"
"We can fix it in the software!"
"It's a BROKEN GEAR!"
|