7#ifndef _MINISKETCH_FALSE_POSITIVES_H_
8#define _MINISKETCH_FALSE_POSITIVES_H_
22 0, 4, 9, 13, 18, 22, 26, 30, 34, 37, 41, 45, 48, 52, 55, 58, 62, 65, 68,
23 71, 74, 77, 80, 82, 85, 88, 90, 93, 96, 98, 101, 103
30 unsigned l2_106 = 106 * (bits - 1) +
T[((x << (32 - bits)) >> 26) & 31];
43 return (418079 * (2 *
uint64_t{x} + 1) *
l2_106 - 127870026 *
uint64_t{x} + 117504694 + 88632748 * (x < 3)) / 88632748;
51 static constexpr uint8_t ADD5[] = {1, 1, 1, 1, 2, 2, 2, 3, 4, 4, 5, 5, 6, 7, 8, 8, 9, 10, 10, 10, 11, 11, 11, 12, 12, 12, 12};
52 static constexpr uint8_t ADD6[] = {1, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 4, 5, 6, 6, 6, 7, 8, 8, 10, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 18, 18, 19, 20, 20, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 24};
53 static constexpr uint8_t ADD7[] = {1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 7, 8, 9, 9, 9, 10, 11, 11, 12, 12, 13, 13, 15, 15, 15, 16, 17, 17, 18, 19, 20, 20};
54 static constexpr uint8_t ADD8[] = {1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 3, 4, 4, 5, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 9, 9};
55 static constexpr uint8_t ADD9[] = {1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 3, 2, 3, 3, 3, 3, 4, 3, 3, 4, 4, 4, 4};
57 if (capacity == 0)
return 0;
60 ret =
uint64_t{bits} * (capacity - (1U << bits) + 1);
61 capacity = (1U << bits) - 1;
65 case 2:
return ret + (capacity <= 2 ? 0 : 1);
66 case 3:
return ret + (capacity <= 2 ? 0 : (0x2a5 >> 2 * (capacity - 3)) & 3);
67 case 4:
return ret + (capacity <= 3 ? 0 : (0xb6d91a449 >> 3 * (capacity - 4)) & 7);
68 case 5:
return ret + (capacity <= 4 ? 0 :
ADD5[capacity - 5]);
83 if (bits == 0)
return 0;
93 if (bits == 0)
return 0;
94 if (capacity > 0xffffffff)
return capacity;
#define T(expected, seed, data)
static int CountBits(I val, int max)
Compute the smallest power of two that is larger than val.
#define CHECK_SAFE(cond)
Check macro that does nothing in normal non-verify builds but crashes in verify builds.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.