Open illusionist-moon opened 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)
targetBit := (hashedKey + idelta) % uint32(len(bitmap)<<3) 改为 targetBit := (hashedKey + idelta) % uint32((len(bitmap)-1)<<3) 即可通过,最后一位为k
结果如下: === 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)