8 #define bit_set(V, B) ((V) | (1U << (B)))
9 #define bit_clear(V, B) ((V) & ~(1U << (B)))
10 #define bit_flip(V, B) ((V) ^ (1U << (B)))
11 #define bit_check(V, B) ((V) & (1U << (B)))
12 #define bit_toggle(V, B, C) ((C) ? bit_set(V, B) : bit_clear(V, B))
13 #define bit_set_assign(V, B) ((V) |= (1U << (B)))
14 #define bit_clear_assign(V, B) ((V) &= ~(1U << (B)))
15 #define bit_flip_assign(V, B) ((V) ^= (1U << (B)))
16 #define bit_toggle_assign(V, B, C) ((C) ? bit_set_assign(V, B) : bit_clear_assign(V, B))
18 #define bitmask_set(V, M) ((V) | (M))
19 #define bitmask_clear(V, M) ((V) & ~(M))
20 #define bitmask_flip(V, M) ((V) ^ (M))
21 #define bitmask_check(V, M) ((V) & (M))
22 #define bitmask_exact(V, M) (((V) & (M)) == (M))
23 #define bitmask_set_assign(V, M) ((V) |= (M))
24 #define bitmask_clear_assign(V, M) ((V) &= ~(M))
25 #define bitmask_flip_assign(V, M) ((V) ^= (M))
32 for (
int i = 0; i < 32; ++i) {
45 for (
int i = 0; i < 32; ++i) {
static int find_first_zero(unsigned long value)
Finds the first bit at zero, starting from the less significative bit.
Definition: bitops.h:30
#define bit_check(V, B)
Checks if the given bit is 1.
Definition: bitops.h:11
static int find_first_non_zero(unsigned long value)
Finds the first bit not zero, starting from the less significative bit.
Definition: bitops.h:43