Author: Dann Corbit
Date: 15:59:16 08/19/99
Go up one level in this thread
It's hard to guess what you are after, but there are lots of ways to manipulate bits in an object. Assuming that you have a char pointer to an object, and that you do not go beyond the total bit counts for that object you can use a technique like this: #define bitset( buf, bit ) ( buf[(bit) >> 3] |= ( 1 << ( (bit) & 7 ))) #define bitclr( buf, bit ) ( buf[(bit) >> 3] &= ~( 1 << ( (bit) & 7 ))) #define bittog( buf, bit ) ( buf[(bit) >> 3] ^= ( 1 << ( (bit) & 7 ))) #define bitget( buf, bit ) ((( buf[(bit) >> 3] >> ( (bit) & 7 )) & 1 ))
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.