summaryrefslogtreecommitdiff
path: root/src/common.h
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@alnilam.(none)>2010-02-01 20:19:45 +0100
committerHenrik Rydberg <rydberg@alnilam.(none)>2010-02-01 20:44:42 +0100
commita7eb5d7a955a2b90ebfbeb5177c3d01e5c287e30 (patch)
treebc9777c1767c95f3c89056847fd6d4b26a8e0152 /src/common.h
parent8dcaab4219c3827c0661917542a28b1276703d8b (diff)
common: add some more bit utilities
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h8
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 @@
54 54
55#define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) 55#define SYSCALL(call) while (((call) == -1) && (errno == EINTR))
56 56
57#define GETBIT(m, x) ((m>>(x))&1U) 57#define BITMASK(x) (1U << (x))
58#define SETBIT(m, x) (m|=(1U<<(x))) 58#define BITONES(x) (BITMASK(x) - 1U)
59#define CLEARBIT(m, x) (m&=~(1U<<(x))) 59#define GETBIT(m, x) (((m) >> (x)) & 1U)
60#define SETBIT(m, x) (m |= BITMASK(x))
61#define CLEARBIT(m, x) (m &= ~BITMASK(x))
60 62
61//////////////////////////////////////////////////////// 63////////////////////////////////////////////////////////
62 64