Skip to content

Commit

Permalink
Use built-in clear function to reset xorset
Browse files Browse the repository at this point in the history
Reference: https://go.dev/ref/spec#Clear
Signed-off-by: Eng Zer Jun <[email protected]>
  • Loading branch information
Juneezee authored and lemire committed Feb 13, 2025
1 parent 770d3f1 commit aa9a026
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions xorfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,6 @@ func scanCount(Qi []keyindex, setsi []xorset) ([]keyindex, int) {
return Qi, QiSize
}

// fill setsi to xorset{0, 0}
func resetSets(setsi []xorset) []xorset {
for i := range setsi {
setsi[i] = xorset{0, 0}
}
return setsi
}

// The maximum number of iterations allowed before the populate function returns an error
var MaxIterations = 1024

Expand Down Expand Up @@ -262,9 +254,9 @@ func Populate(keys []uint64) (*Xor8, error) {
size = len(keys)
}

sets0 = resetSets(sets0)
sets1 = resetSets(sets1)
sets2 = resetSets(sets2)
clear(sets0)
clear(sets1)
clear(sets2)

filter.Seed = splitmix64(&rngcounter)
}
Expand Down

0 comments on commit aa9a026

Please sign in to comment.