PSI sics-cvs-psi_pre-ansto

This commit is contained in:
2003-06-13 00:00:00 +00:00
committed by Douglas Clowes
parent 2e3ddfb6c6
commit 3ffd0d8af4
1099 changed files with 318432 additions and 0 deletions

17
bit.h Normal file
View File

@@ -0,0 +1,17 @@
/*--------------------------------------------------------------------------
Macros for handling bits in a character array. Stolen somewhere on the
internet. Working!
Dr. Mark Koennecke 15.6.1994
----------------------------------------------------------------------------*/
#include <limits.h> /* for CHAR_BIT */
#define BITMASK(bit) (1 << ((bit) % CHAR_BIT))
#define BITSLOT(bit) ((bit) / CHAR_BIT)
#define BITSET(ary, bit) ((ary)[BITSLOT(bit)] |= BITMASK(bit))
#define BITTEST(ary, bit) ((ary)[BITSLOT(bit)] & BITMASK(bit))
#define BITUNSET(ary, bit) ((ary)[BITSLOT(bit)] ^= BITMASK(bit))