From: Carlo Alberto Ferraris Date: Sun, 25 Jul 2021 23:15:15 +0000 (+0000) Subject: runtime: constify a test variable X-Git-Tag: go1.18beta1~1510 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a35c5c98c0;p=gostls13.git runtime: constify a test variable Simple cleanup, no functionality change. Change-Id: I8eceda4496a396e0117a0a601186c653982fb004 GitHub-Last-Rev: 58defc575e5834a3685bbb8179fdee4afa8d8fc7 GitHub-Pull-Request: golang/go#47389 Reviewed-on: https://go-review.googlesource.com/c/go/+/337289 Reviewed-by: Austin Clements Run-TryBot: Austin Clements TryBot-Result: Go Bot Trust: Cherry Mui --- diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index e7279564e3..01fd1dbd97 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -198,7 +198,7 @@ func MemclrBytes(b []byte) { memclrNoHeapPointers(s.array, uintptr(s.len)) } -var HashLoad = &hashLoad +const HashLoad = hashLoad // entry point for testing func GostringW(w []uint16) (s string) { diff --git a/src/runtime/map_test.go b/src/runtime/map_test.go index 24556b4093..f78cad5a77 100644 --- a/src/runtime/map_test.go +++ b/src/runtime/map_test.go @@ -473,7 +473,7 @@ func TestMapNanGrowIterator(t *testing.T) { nan := math.NaN() const nBuckets = 16 // To fill nBuckets buckets takes LOAD * nBuckets keys. - nKeys := int(nBuckets * *runtime.HashLoad) + nKeys := int(nBuckets * runtime.HashLoad) // Get map to full point with nan keys. for i := 0; i < nKeys; i++ { diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go index 8a520d7839..c85b7d7330 100644 --- a/src/runtime/stubs.go +++ b/src/runtime/stubs.go @@ -119,7 +119,7 @@ func reflect_memmove(to, from unsafe.Pointer, n uintptr) { } // exported value for testing -var hashLoad = float32(loadFactorNum) / float32(loadFactorDen) +const hashLoad = float32(loadFactorNum) / float32(loadFactorDen) //go:nosplit func fastrand() uint32 {