Skip to content

Instantly share code, notes, and snippets.

@starius
Created February 25, 2017 17:17
Show Gist options
  • Select an option

  • Save starius/2c0dea4d9ee39a03b17471a85a06e164 to your computer and use it in GitHub Desktop.

Select an option

Save starius/2c0dea4d9ee39a03b17471a85a06e164 to your computer and use it in GitHub Desktop.
diff --git a/bloom.go b/bloom.go
index e19ba10..b7f74c7 100644
--- a/bloom.go
+++ b/bloom.go
@@ -72,6 +72,9 @@ type BloomFilter struct {
// New creates a new Bloom filter with _m_ bits and _k_ hashing functions
func New(m uint, k uint) *BloomFilter {
+ if m == 0 {
+ m = 1
+ }
return &BloomFilter{m, k, bitset.New(m)}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment