MasterGod wrote:
I'm starting with 1 cause its more easy to think/say "the 7th bit is:" then "the bit in the 6th place is:"..
That's certainly up to you, but I'd recommend starting to count at 0. It's not really more difficult once you get used to it and you _will_ get used to it in the long run when programming :-)
Also when using bitoperations you often care about speed and adding the '-1' will make your operation slower.
Would this work ?
#define isBitSet(num,n) (( num & (0x01<<n) ) ?1:0;)
#define setBit(num,n) ( num |= (0x01<<n) )
#define clearBit(num,n) ( num &= (0x01<<n) )