MCPcopy Create free account
hub / github.com/albertobsd/keyhunt / test_bit_set_bit

Function test_bit_set_bit

bloom/bloom.cpp:34–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32#define BLOOM_VERSION_MINOR 201
33
34inline static int test_bit_set_bit(uint8_t *bf, uint64_t bit, int set_bit)
35{
36 uint64_t byte = bit >> 3;
37 uint8_t c = bf[byte]; // expensive memory access
38 uint8_t mask = 1 << (bit % 8);
39 if (c & mask) {
40 return 1;
41 } else {
42 if (set_bit) {
43 bf[byte] = c | mask;
44 }
45 return 0;
46 }
47}
48
49inline static int test_bit(uint8_t *bf, uint64_t bit)
50{

Callers 1

bloom_check_addFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected