This repository was archived by the owner on Mar 21, 2025. It is now read-only.
File tree 2 files changed +4
-4
lines changed
2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ func New(size int, numHashFuncs int) *BloomFilter {
53
53
54
54
// Create hash functions
55
55
for i := 0 ; i < numHashFuncs ; i ++ {
56
- seed := uint32 (i )
56
+ seed := uint32 (i ) // Seed for the hash function
57
57
hashFuncs [i ] = func (data []byte ) uint32 {
58
58
return murmur .Hash32 (data , seed ) // Return the hash value
59
59
}
@@ -168,7 +168,7 @@ func Deserialize(data []byte) (*BloomFilter, error) {
168
168
if err := binary .Read (buf , binary .LittleEndian , & bitArraySize ); err != nil {
169
169
return nil , err
170
170
}
171
- if bitArraySize < 0 || bitArraySize > 1 << 20 { // Add reasonable limit
171
+ if bitArraySize < 0 || bitArraySize > 1 << 20 { // Check if the bit array size is valid
172
172
return nil , errors .New ("invalid bit array size" )
173
173
}
174
174
bf .bitArray = make ([]bool , bitArraySize )
Original file line number Diff line number Diff line change @@ -1986,7 +1986,7 @@ func (it *Iterator) Next() ([]byte, []byte) {
1986
1986
return key , value
1987
1987
}
1988
1988
} else {
1989
- it .sstIterIndex --
1989
+ it .sstIterIndex -- // If we have no more keys in the sstable we move to the next sstable
1990
1990
}
1991
1991
}
1992
1992
@@ -2045,7 +2045,7 @@ func (it *Iterator) Prev() ([]byte, []byte) {
2045
2045
return key , value
2046
2046
}
2047
2047
} else {
2048
- it .sstIterIndex ++
2048
+ it .sstIterIndex ++ // If we have no more keys in the sstable we move to the next sstable
2049
2049
2050
2050
}
2051
2051
}
You can’t perform that action at this time.
0 commit comments