Add some very useful helper macros: NELEMS() and bitops.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2015-08-21 09:42:43 +02:00
1 parent a4cbc7a10e
commit 117ec58a90
2 files changed
+50

No files matched your search

+25
View File
@@ -57,6 +57,31 @@ Helper Macros
Mysteriously missing from GLIBC
- `ISCLR(word,bit)`
Is bit in (integer) word cleared?
- `ISSET(word,bit)`
Is bit in (integer) word set?
- `ISOTHER(word,bit)`
Is any other bits, except bit, in (integer) word set?
- `SETBIT(word,bit)`
Set bit in (integer) word.
- `CLRBIT(word,bit)`
Clear bit in (integer) word.
- `NELEMS(array)`
Returns the number of elements in an array. From the great book, The
Practice of Programming, by Kernighan and Pike.
- `UNUSED(var)`
Shorter and more readable version of `var __attribute__ ((unused))`