AVR GCC Bit Manipulation Macros
These are some macros i originally found on avrfreaks for bit manipulation. I have posted them here in case they are useful to anyone.
#define bit_get(p,m) ((p) & (m)) #define bit_set(p,m) ((p) |= (m)) #define bit_clear(p,m) ((p) &= ~(m)) #define bit_flip(p,m) ((p) ^= (m)) #define bit_write(c,p,m) (c ? bit_set(p,m) : bit_clear(p,m)) #define BIT(x) (0x01 < < (x)) #define LONGBIT(x) ((unsigned long)0x00000001 << (x))
