1
0
mirror of https://github.com/fumiama/gofastTEA.git synced 2026-07-01 07:20:24 +08:00

optimize: drop linkname

This commit is contained in:
源文雨
2024-11-09 01:34:07 +09:00
parent 3a1a8fa624
commit 7d42c37612
4 changed files with 35 additions and 15 deletions

19
rand_1.21.go Normal file
View File

@@ -0,0 +1,19 @@
//go:build !go1.22
package tea
import (
_ "unsafe" // required by go:linkname
)
// randuint32 returns a lock free uint32 value.
//
// Too much legacy code has go:linkname references
// to runtime.fastrand and friends, so keep these around for now.
// Code should migrate to math/rand/v2.Uint64,
// which is just as fast, but that's only available in Go 1.22+.
// It would be reasonable to remove these in Go 1.24.
// Do not call these from package runtime.
//
//go:linkname randuint32 runtime.fastrand
func randuint32() uint32