Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sgreben committed Sep 19, 2024
1 parent 4b23add commit 4a85b95
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import "github.com/OneOfOne/xxhash"

const hashSeed = 4848280

// Fingerprint returns an item's fingerprint.
func Fingerprint(item string) uint32 {
return xxhash.ChecksumString32S(item, hashSeed)
}

// BucketIndex returns the counter bucket index for an item in the given row of the sketch.
func BucketIndex(item string, row, width int) int {
column := int(xxhash.ChecksumString32S(item, uint32(row))) % width
return row*width + column
Expand Down

0 comments on commit 4a85b95

Please sign in to comment.