Skip to content

Commit 2e95317

Browse files
committed
fix: add missing Go declarations for assembly functions
1 parent 04dd2a3 commit 2e95317

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

internal/hash/batch_amd64.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ import (
66
"unsafe"
77
)
88

9+
//go:noescape
10+
func mix64Asm(x uint64) uint64
11+
12+
//go:noescape
13+
func mix64x4Asm(x0, x1, x2, x3 uint64) (r0, r1, r2, r3 uint64)
14+
15+
//go:noescape
16+
func shardIndex(hash, mask uint64) uint64
17+
918
// HashStringBatch computes hashes for multiple strings.
1019
// Uses optimized memory access patterns for better cache utilization.
1120
func HashStringBatch(keys []string, hashes []uint64) {

internal/policy/bloom_amd64.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@ import (
1111
"github.com/OrlovEvgeny/go-mcache/internal/alloc"
1212
)
1313

14+
//go:noescape
15+
func bloomCheckBit(bits unsafe.Pointer, idx uint64) bool
16+
17+
//go:noescape
18+
func bloomSetBit(bits unsafe.Pointer, idx uint64) bool
19+
20+
//go:noescape
21+
func bloomContains8(bits unsafe.Pointer, indices *[8]uint64, numBits uint64) uint8
22+
23+
//go:noescape
24+
func popcountAVX2(x uint64) int
25+
26+
//go:noescape
27+
func doubleHash(keyHash uint64, i int) uint64
28+
1429
// bloomFilterSIMD is a SIMD-optimized bloom filter.
1530
// Uses aligned memory and optimized hash position calculations.
1631
type bloomFilterSIMD struct {

internal/policy/sketch_amd64.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ import (
99
"github.com/OrlovEvgeny/go-mcache/internal/alloc"
1010
)
1111

12+
//go:noescape
13+
func cmEstimateMinAVX2(row0, row1, row2, row3 unsafe.Pointer, idx0, idx1, idx2, idx3 uint64) uint8
14+
15+
//go:noescape
16+
func cmIncrementSaturatingAVX2(ptr unsafe.Pointer, idx uint64) uint8
17+
18+
//go:noescape
19+
func hashMix64(x uint64) uint64
20+
1221
// cmSketchSIMD is a SIMD-optimized Count-Min Sketch.
1322
// Uses 8-bit counters with memory aligned for AVX2 operations.
1423
type cmSketchSIMD struct {

0 commit comments

Comments
 (0)