increase branching factor to 16

master
magical 2022-01-23 00:24:49 +00:00
parent a3fa9b2387
commit ad0c66c4aa
1 changed files with 12 additions and 5 deletions

17
pmap.go
View File

@ -1,8 +1,13 @@
package pmap
const deg = 8 // branch factor of nodes
const log2deg = 3
const mask = 0b111
import (
"fmt"
"math/bits"
)
const deg = 16 // branch factor of nodes
const log2deg = 4
const mask = 0b1111
type Key = interface{}
type Value = interface{}
@ -80,8 +85,10 @@ func (p pmap) Del(k Key) Map {
}
func hash(k Key) uint32 {
u := k.(int)
return uint32(uint(u) + uint(u)>>32)
//u := uint(k.(int))*6364136223846793005 + 1
//return uint32(u >> 32)
u := uint(k.(int))
return uint32(u + u>>32)
}
func (m *node) getNode(shift, hash uint32, key Key) interface{} {