FastFilter / xor_singleheader

Header-only binary fuse and xor filter library
Apache License 2.0
348 stars 32 forks source link

binary fuse filter: allow size=0,size=1,size=2 and add tests #27

Closed slimsag closed 3 years ago

slimsag commented 3 years ago

In dabe36530e3598d648d67012c9a6362b698f5598 checks were added to prevent creation of filters with size <= 1, and while these incredibly small sizes are not particularly useful in a binary fuse filter, keeping the property that all sizes [0..N] are allowed is nice due to the fact that, if the restriction is in place, you must:

With this change, input sizes 0,1,2 are allowed and consume no more memory than size=3 (there is no overflow condition in calculating the array length.)

Also added a few tests for these three edge cases.

Ref #26

Signed-off-by: Stephen Gutekanst stephen@hexops.com

lemire commented 3 years ago

Why not!

lemire commented 3 years ago

Merged.