Updated with bit macros.

This commit is contained in:
skarg
2008-11-04 22:30:10 +00:00
parent 335c07c367
commit 2284a70bc2
+12
View File
@@ -70,4 +70,16 @@
#define BIT30 (0x40000000UL)
#define BIT31 (0x80000000UL)
/* a=register, b=bit number to act upon 0-n */
#define BIT_SET(a,b) ((a) |= (1<<(b)))
#define BIT_CLEAR(a,b) ((a) &= ~(1<<(b)))
#define BIT_FLIP(a,b) ((a) ^= (1<<(b)))
#define BIT_CHECK(a,b) ((a) & (1<<(b)))
/* x=target variable, y=mask */
#define BITMASK_SET(x,y) ((x) |= (y))
#define BITMASK_CLEAR(x,y) ((x) &= (~(y)))
#define BITMASK_FLIP(x,y) ((x) ^= (y))
#define BITMASK_CHECK(x,y) ((x) & (y))
#endif