mirror of
https://github.com/golang/go
synced 2024-11-17 05:54:46 -07:00
runtime: use fastrand64 in mapiterinit
Change-Id: I5698c7576a0f39ae62de7bea64286ac8e578d421 Reviewed-on: https://go-review.googlesource.com/c/go/+/400916 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
c2d436dcfa
commit
01b8f5e882
@ -842,9 +842,11 @@ func mapiterinit(t *maptype, h *hmap, it *hiter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// decide where to start
|
// decide where to start
|
||||||
r := uintptr(fastrand())
|
var r uintptr
|
||||||
if h.B > 31-bucketCntBits {
|
if h.B > 31-bucketCntBits {
|
||||||
r += uintptr(fastrand()) << 31
|
r = uintptr(fastrand64())
|
||||||
|
} else {
|
||||||
|
r = uintptr(fastrand())
|
||||||
}
|
}
|
||||||
it.startBucket = r & bucketMask(h.B)
|
it.startBucket = r & bucketMask(h.B)
|
||||||
it.offset = uint8(r >> h.B & (bucketCnt - 1))
|
it.offset = uint8(r >> h.B & (bucketCnt - 1))
|
||||||
|
Loading…
Reference in New Issue
Block a user