xiaoxuxiansheng / golsm

41 stars 7 forks source link

布隆过滤器单测失败 #2

Open illusionist-moon opened 5 months ago

illusionist-moon commented 5 months ago

结果如下: === RUN Test_BloomFilter_Add_Exist bloom_filter_test.go:25: key: a, expect: true, got: false bloom_filter_test.go:29: key: b, expect: true, got: false bloom_filter_test.go:33: key: c, expect: true, got: false bloom_filter_test.go:37: key: d, expect: true, got: false --- FAIL: Test_BloomFilter_Add_Exist (0.00s)

illusionist-moon commented 5 months ago

targetBit := (hashedKey + idelta) % uint32(len(bitmap)<<3) 改为 targetBit := (hashedKey + idelta) % uint32((len(bitmap)-1)<<3) 即可通过,最后一位为k