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:
Verify your set length is >= 1.
If it isn't, use a separate code path to lookup and encode your 0, 1, or 2 keys
outside the binary fuse filter. And also handle encoding that to a file if you
e.g. intend to serialize the filter to disk.
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.
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