Skip to content

Commit

Permalink
fix hasher typo
Browse files Browse the repository at this point in the history
  • Loading branch information
phuslu committed Mar 20, 2024
1 parent db790b1 commit 6980cb5
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lru_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
type LRUCache[K comparable, V any] struct {
shards [512]lrushard[K, V]
mask uint32
hasher func(K unsafe.Pointer, seed uintptr) uintptr
hasher func(key unsafe.Pointer, seed uintptr) uintptr
seed uintptr
loader func(key K) (value V, err error)
group singleflight_Group[K, V]
Expand Down
4 changes: 2 additions & 2 deletions lru_shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type lrushard[K comparable, V any] struct {
buckets []lrubucket
mask uint32
length uint32
hasher func(K unsafe.Pointer, seed uintptr) uintptr
hasher func(key unsafe.Pointer, seed uintptr) uintptr
seed uintptr
}

Expand All @@ -46,7 +46,7 @@ type lrushard[K comparable, V any] struct {
_ [24]byte
}

func (s *lrushard[K, V]) Init(size uint32, hasher func(K unsafe.Pointer, seed uintptr) uintptr, seed uintptr) {
func (s *lrushard[K, V]) Init(size uint32, hasher func(key unsafe.Pointer, seed uintptr) uintptr, seed uintptr) {
s.list_Init(size)
s.table_Init(size, hasher, seed)
}
Expand Down
2 changes: 1 addition & 1 deletion lru_shard_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const (
maxDIB = ^uint32(0) >> hashBitSize // max 255
)

func (s *lrushard[K, V]) table_Init(size uint32, hasher func(K unsafe.Pointer, seed uintptr) uintptr, seed uintptr) {
func (s *lrushard[K, V]) table_Init(size uint32, hasher func(key unsafe.Pointer, seed uintptr) uintptr, seed uintptr) {
newsize := lruNewTableSize(size)
if len(s.table.buckets) == 0 {
s.table.buckets = make([]lrubucket, newsize)
Expand Down
2 changes: 1 addition & 1 deletion ttl_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
type TTLCache[K comparable, V any] struct {
shards [512]ttlshard[K, V]
mask uint32
hasher func(K unsafe.Pointer, seed uintptr) uintptr
hasher func(key unsafe.Pointer, seed uintptr) uintptr
seed uintptr
loader func(key K) (value V, ttl time.Duration, err error)
group singleflight_Group[K, V]
Expand Down
4 changes: 2 additions & 2 deletions ttl_shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type ttlshard[K comparable, V any] struct {
buckets []ttlbucket
mask uint32
length uint32
hasher func(K unsafe.Pointer, seed uintptr) uintptr
hasher func(key unsafe.Pointer, seed uintptr) uintptr
seed uintptr
}

Expand All @@ -52,7 +52,7 @@ type ttlshard[K comparable, V any] struct {
_ [16]byte
}

func (s *ttlshard[K, V]) Init(size uint32, hasher func(K unsafe.Pointer, seed uintptr) uintptr, seed uintptr) {
func (s *ttlshard[K, V]) Init(size uint32, hasher func(key unsafe.Pointer, seed uintptr) uintptr, seed uintptr) {
s.list_Init(size)
s.table_Init(size, hasher, seed)
}
Expand Down
2 changes: 1 addition & 1 deletion ttl_shard_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"unsafe"
)

func (s *ttlshard[K, V]) table_Init(size uint32, hasher func(K unsafe.Pointer, seed uintptr) uintptr, seed uintptr) {
func (s *ttlshard[K, V]) table_Init(size uint32, hasher func(key unsafe.Pointer, seed uintptr) uintptr, seed uintptr) {
newsize := ttlNewTableSize(size)
if len(s.table.buckets) == 0 {
s.table.buckets = make([]ttlbucket, newsize)
Expand Down

0 comments on commit 6980cb5

Please sign in to comment.