mask to represent a boolean value using only 1 bit
This commit is contained in:
9
src/bitbool.h
Normal file
9
src/bitbool.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef _CMPH_BITBOOL_H__
|
||||
#define _CMPH_BITBOOL_H__
|
||||
#include "cmph_types.h"
|
||||
extern const cmph_uint8 bitmask[];
|
||||
#define GETBIT(array, i) (array[(i) / 8] & bitmask[(i) % 8])
|
||||
#define SETBIT(array, i) (array[(i) / 8] |= bitmask[(i) % 8])
|
||||
#define UNSETBIT(array, i) (array[(i) / 8] &= (~(bitmask[(i) % 8])))
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user