diff options
| author | apocelipes <seve3r@outlook.com> | 2024-03-08 10:12:41 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-03-08 16:28:44 +0000 |
| commit | c8c46e746b778c39727c588adf79aff34ab6f151 (patch) | |
| tree | f31e5cbc08220e791e9137e57e1e70016cb89f41 /src/runtime/mpallocbits.go | |
| parent | 69583738eb73ef928a07a1e215b719823fd27aa9 (diff) | |
| download | go-c8c46e746b778c39727c588adf79aff34ab6f151.tar.xz | |
runtime: use built-in clear to simplify code
Change-Id: Icb6d9ca996b4119d8636d9f7f6a56e510d74d059
GitHub-Last-Rev: 08178e8ff798f4a51860573788c9347a0fb6bc40
GitHub-Pull-Request: golang/go#66188
Reviewed-on: https://go-review.googlesource.com/c/go/+/569979
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/runtime/mpallocbits.go')
| -rw-r--r-- | src/runtime/mpallocbits.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/runtime/mpallocbits.go b/src/runtime/mpallocbits.go index 6b5f15dbd8..9f447557c6 100644 --- a/src/runtime/mpallocbits.go +++ b/src/runtime/mpallocbits.go @@ -85,18 +85,14 @@ func (b *pageBits) clearRange(i, n uint) { _ = b[j/64] // Clear leading bits. b[i/64] &^= ^uint64(0) << (i % 64) - for k := i/64 + 1; k < j/64; k++ { - b[k] = 0 - } + clear(b[i/64+1 : j/64]) // Clear trailing bits. b[j/64] &^= (uint64(1) << (j%64 + 1)) - 1 } // clearAll frees all the bits of b. func (b *pageBits) clearAll() { - for i := range b { - b[i] = 0 - } + clear(b[:]) } // clearBlock64 clears the 64-bit aligned block of bits containing the i'th bit that |
