Skip to content

Commit

Permalink
Update cpu.go
Browse files Browse the repository at this point in the history
  • Loading branch information
kolinfluence authored Mar 15, 2024
1 parent 3350bf1 commit 89fd2a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion thread/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func SetCPUAffinity(cpu uint16) error {

// Updated function to use xxh3 for hashing with AVX2 optimization when available.
func CPUHash(k []byte) uint16 {
return uint16(xxh3.Hash(k) % uint64(runtime.NumCPU()))
return uint16(xxh3.Hash(k) & uint64(runtime.NumCPU()-1))
}

func IsCurrentCPUID(id uint16) uint8 {
Expand Down

0 comments on commit 89fd2a8

Please sign in to comment.