MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / test_bit_set_bit

Function test_bit_set_bit

libCacheSim/dataStructure/bloom.c:36–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34#define STRING(n) #n
35
36inline static int test_bit_set_bit(unsigned char *buf, unsigned int x,
37 int set_bit) {
38 unsigned int byte = x >> 3;
39 unsigned char c = buf[byte]; // expensive memory access
40 unsigned int mask = 1 << (x % 8);
41
42 if (c & mask) {
43 return 1;
44 } else {
45 if (set_bit) {
46 buf[byte] = c | mask;
47 }
48 return 0;
49 }
50}
51
52static int bloom_check_add(struct bloom *bloom, const void *buffer, int len,
53 int add) {

Callers 1

bloom_check_addFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected