switch to integer Keys and Values

for fairer comparisons
master
magical 2022-01-23 01:34:34 +00:00
parent 28e69d7fb4
commit bb1aa352aa
2 changed files with 3 additions and 3 deletions

View File

@ -11,8 +11,8 @@ const (
nodeMask = 0b1111 nodeMask = 0b1111
) )
type Key = interface{} type Key = int
type Value = interface{} type Value = int
type Map interface { type Map interface {
Get(Key) (Value, bool) Get(Key) (Value, bool)

View File

@ -8,7 +8,7 @@ import (
func hash(k Key) uint32 { func hash(k Key) uint32 {
//u := uint(k.(int))*6364136223846793005 + 1 //u := uint(k.(int))*6364136223846793005 + 1
//return uint32(u >> 32) //return uint32(u >> 32)
u := uint(k.(int)) u := uint(k) //u := uint(k.(int))
return uint32(u + u>>32) return uint32(u + u>>32)
} }