libusual
0.1
|
Map 256 byte values to bit or int. More...
Data Structures | |
struct | Bitmap256 |
Bitmap of 256 bits. More... | |
Defines | |
#define | BITMAP256_CONST(check) |
Use C preprocessor to fill Bitmap256. | |
#define | INTMAP256_CONST(map_value) |
Use C preprocessor to generate array of 256 values. | |
Functions | |
static void | bitmap256_init (struct Bitmap256 *bmap) |
Clear bitmap. | |
static void | bitmap256_set (struct Bitmap256 *bmap, uint8_t byte) |
Set one bit. | |
static bool | bitmap256_is_set (const struct Bitmap256 *bmap, uint8_t byte) |
Check if bit is set. |
Map 256 byte values to bit or int.
#define BITMAP256_CONST | ( | check | ) |
Use C preprocessor to fill Bitmap256.
Usage:
#define check_isdigit(c) ((c) >= '0' && (c) <= '9') static const struct Bitmap256 map_isdigit = BITMAP256_CONST(check_isdigit);
#define INTMAP256_CONST | ( | map_value | ) |
Use C preprocessor to generate array of 256 values.
Usage:
#define my_hexval(c) (((c) >= '0' && (c) <= '9') ? ((c) - '0') : ( \ ((c) >= 'A' && (c) <= 'F') ? ((c) - 'A' + 10) : ( \ ((c) >= 'a' && (c) <= 'f') ? ((c) - 'a' + 10) : -1 ))) static const int map_hexval[] = INTMAP256_CONST(my_hexval);
static void bitmap256_init | ( | struct Bitmap256 * | bmap | ) | [inline, static] |
Clear bitmap.
static void bitmap256_set | ( | struct Bitmap256 * | bmap, |
uint8_t | byte | ||
) | [inline, static] |
Set one bit.
static bool bitmap256_is_set | ( | const struct Bitmap256 * | bmap, |
uint8_t | byte | ||
) | [inline, static] |
Check if bit is set.