View Single Post
  #7   Spotlight this post!  
Unread 08-01-2004, 13:57
Noah's Avatar
Noah Noah is offline
Code Monkey
#0861 (The Gondobots)
Team Role: Programmer
 
Join Date: Apr 2002
Location: Venice, California
Posts: 139
Noah has a spectacular aura aboutNoah has a spectacular aura about
Send a message via AIM to Noah
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!"