| 34 | #define STRING(n) #n |
| 35 | |
| 36 | inline 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 | |
| 52 | static int bloom_check_add(struct bloom *bloom, const void *buffer, int len, |
| 53 | int add) { |