tivvit / pure-lua-bloom-filter

pure luajit bloom filter implementation
MIT License
10 stars 2 forks source link

some bugs? #1

Open fankeke opened 5 years ago

fankeke commented 5 years ago

https://github.com/tivvit/pure-lua-bloom-filter/blob/14bc42e9f4147c5f28c5f9b486f4ed4c24e50e53/bloom_filter.lua#L96

should be

for i = 0, self.bits do

-->

for i = 0, self.bytes do

https://github.com/tivvit/pure-lua-bloom-filter/blob/14bc42e9f4147c5f28c5f9b486f4ed4c24e50e53/bloom_filter.lua#L42

start for `1` would be better
for i = 1, self.bytes do

【same above】
fankeke commented 5 years ago

another one:

 local b = xxh32(val, i) % self.bits;

should be

 local b = xxh32(val, string.len(val), i) % self.bits;