diff options
Diffstat (limited to 'src/common.h')
-rw-r--r-- | src/common.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/common.h b/src/common.h index f9d9f77..b1c3273 100644 --- a/src/common.h +++ b/src/common.h @@ -54,9 +54,11 @@ #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) -#define GETBIT(m, x) ((m>>(x))&1U) -#define SETBIT(m, x) (m|=(1U<<(x))) -#define CLEARBIT(m, x) (m&=~(1U<<(x))) +#define BITMASK(x) (1U << (x)) +#define BITONES(x) (BITMASK(x) - 1U) +#define GETBIT(m, x) (((m) >> (x)) & 1U) +#define SETBIT(m, x) (m |= BITMASK(x)) +#define CLEARBIT(m, x) (m &= ~BITMASK(x)) //////////////////////////////////////////////////////// |