Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::detail::BloomProbes< kLog2Slots > Struct Template Reference

The two probe positions both filters derive from a BloomHash: bits 0 to kLog2Slots-1 and bits kLog2Slots to 2*kLog2Slots-1. More...

#include "donner/base/BloomFilter.h"

Static Public Member Functions

static constexpr std::size_t First (BloomHash hash) noexcept
 Returns the first probe position, from the low bits.
static constexpr std::size_t Second (BloomHash hash) noexcept
 Returns the second probe position, from the next kLog2Slots bits.
static double ExpectedFalsePositiveRate (std::size_t keys) noexcept
 Approximates the false-positive rate after inserting keys distinct uniformly hashed keys into kSlots slots with two probes each: (1 - (1 - 1/kSlots)^(2 * keys))^2.

Static Public Attributes

static constexpr std::size_t kSlots = std::size_t{1} << kLog2Slots
 Number of slots.
static constexpr std::uint32_t kIndexMask = static_cast<std::uint32_t>(kSlots - 1)
 Mask selecting one probe's index bits.

Detailed Description

template<int kLog2Slots>
struct donner::detail::BloomProbes< kLog2Slots >

The two probe positions both filters derive from a BloomHash: bits 0 to kLog2Slots-1 and bits kLog2Slots to 2*kLog2Slots-1.

The ranges are disjoint, so both fit in 32 bits only for at most 16 index bits.

Template Parameters
kLog2SlotsBase-2 logarithm of the slot count.

Member Function Documentation

◆ ExpectedFalsePositiveRate()

template<int kLog2Slots>
double donner::detail::BloomProbes< kLog2Slots >::ExpectedFalsePositiveRate ( std::size_t keys)
inlinestaticnoexcept

Approximates the false-positive rate after inserting keys distinct uniformly hashed keys into kSlots slots with two probes each: (1 - (1 - 1/kSlots)^(2 * keys))^2.

The estimate treats the two occupancy checks as independent.

Parameters
keysNumber of keys present.

The documentation for this struct was generated from the following file: