-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly handle empty bloom filters, avoid infinite loop (#9)
`HashIndexIterator` used to loop infinitely when `bit_size` was 0, because it wouldn't be able to generate a random index that's `< 0` (fair enough). Now it simply exists instantly if `bit_size == 0`. Also added a test case for empty blooms. They "technically" contain everything as a false positive. I opted for that, rather than "an empty bloom contains nothing", since that keeps the invariant that if you `.insert` something into a bloom filter, it will *always* be `contain`ed.
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters