Skip to content

Conversation

@Juneezee
Copy link
Contributor

Reference: https://go.dev/ref/spec#Clear

The built-in clear function introduced in Go 1.21 does the job of resetSets function.

Playground example: https://go.dev/play/p/7d4DsuYqY2t

package main

import "fmt"

type xorset struct {
	xormask uint64
	count   uint32
}

func main() {
	sets0 := []xorset{
		xorset{1, 1},
		xorset{2, 2},
		xorset{3, 3},
	}

	fmt.Println(sets0)
	clear(sets0)
	fmt.Println(sets0)
}
[{1 1} {2 2} {3 3}]
[{0 0} {0 0} {0 0}]

Reference: https://go.dev/ref/spec#Clear
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
@lemire
Copy link
Member

lemire commented Feb 13, 2025

Sounds reasonable.

@lemire lemire merged commit aa9a026 into FastFilter:master Feb 13, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants