Skip to content

Commit

Permalink
Merge pull request #17 from Aoang/fix/fastrand-go-122
Browse files Browse the repository at this point in the history
Fix: update calls to `runtime.fastrand` to use `cheaprand` for compatibility with Go 1.22
  • Loading branch information
alphadose authored Mar 12, 2024
2 parents 43a1241 + b383438 commit 271950c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
10 changes: 10 additions & 0 deletions lib_runtime_fastrand.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build !go1.22

package zenq

import (
_ "unsafe"
)

//go:linkname Fastrand runtime.fastrand
func Fastrand() uint32
10 changes: 10 additions & 0 deletions lib_runtime_fastrand_1.22.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build go1.22

package zenq

import (
_ "unsafe"
)

//go:linkname Fastrand runtime.cheaprand
func Fastrand() uint32
3 changes: 0 additions & 3 deletions lib_runtime_linkage.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ func goparkunlock(lock *mutex, reason waitReason, traceEv byte, traceskip int)
// defined in the asm files
func GetG() unsafe.Pointer

//go:linkname Fastrand runtime.fastrand
func Fastrand() uint32

//go:linkname Fastlog2 runtime.fastlog2
func Fastlog2(x float64) float64

Expand Down

0 comments on commit 271950c

Please sign in to comment.