X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=lib%2Fbloom.c;h=bb81dbbdf8c9b285b1f43f3b339f346a90881a63;hb=dcf9844e850e01d7c4db59960bbc4450a8cbf7ef;hp=9ccec5fa14a0c2cf2d6794efc754a9e894cab06b;hpb=eb50727a93ce10568973d6fc6b267b966e65b698;p=fio.git diff --git a/lib/bloom.c b/lib/bloom.c index 9ccec5fa..bb81dbbd 100644 --- a/lib/bloom.c +++ b/lib/bloom.c @@ -60,19 +60,17 @@ static struct bloom_hash hashes[] = { #define N_HASHES 5 -#define MIN_ENTRIES 1073741824UL - struct bloom *bloom_new(uint64_t entries) { struct bloom *b; size_t no_uints; + crc32c_arm64_probe(); crc32c_intel_probe(); b = malloc(sizeof(*b)); b->nentries = entries; no_uints = (entries + BITS_PER_INDEX - 1) / BITS_PER_INDEX; - no_uints = max((unsigned long) no_uints, MIN_ENTRIES); b->map = calloc(no_uints, sizeof(uint32_t)); if (!b->map) { free(b); @@ -106,8 +104,10 @@ static bool __bloom_check(struct bloom *b, const void *data, unsigned int len, if (b->map[index] & (1U << bit)) was_set++; - if (set) + else if (set) b->map[index] |= 1U << bit; + else + break; } return was_set == N_HASHES;