Skip to content

Commit

Permalink
Merge pull request #74 from paralin/from-with-m
Browse files Browse the repository at this point in the history
bloom: add func to create bloom with data and m
  • Loading branch information
lemire authored Mar 23, 2022
2 parents bb11d04 + ddfde51 commit 1a7c5a5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bloom.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ func New(m uint, k uint) *BloomFilter {
// functions. The data slice is not going to be reset.
func From(data []uint64, k uint) *BloomFilter {
m := uint(len(data) * 64)
return FromWithM(data, m, k)
}

// FromWithM creates a new Bloom filter with _m_ length, _k_ hashing functions.
// The data slice is not going to be reset.
func FromWithM(data []uint64, m, k uint) *BloomFilter {
return &BloomFilter{m, k, bitset.From(data)}
}

Expand Down

0 comments on commit 1a7c5a5

Please sign in to comment.