diff options
| author | Youlin Feng <fengyoulin@live.com> | 2022-10-05 15:29:29 +0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2022-10-18 18:06:27 +0000 |
| commit | 7ae652b7c0cddb8f6e04bfa6f5805baac823dd64 (patch) | |
| tree | 04b02db5fd0e54ac405a67b3ef6b297bffd0fbfb /src/runtime/mbitmap.go | |
| parent | c45ebef05edcb217be8f9bf1d7649763132727cc (diff) | |
| download | go-7ae652b7c0cddb8f6e04bfa6f5805baac823dd64.tar.xz | |
runtime: replace all uses of CtzXX with TrailingZerosXX
Replace all uses of Ctz64/32/8 with TrailingZeros64/32/8, because they
are the same and maybe duplicated. Also renamed CtzXX functions in 386
assembly code.
Change-Id: I19290204858083750f4be589bb0923393950ae6d
Reviewed-on: https://go-review.googlesource.com/c/go/+/438935
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/mbitmap.go')
| -rw-r--r-- | src/runtime/mbitmap.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/runtime/mbitmap.go b/src/runtime/mbitmap.go index 8a4a61c27d..7cc22309f1 100644 --- a/src/runtime/mbitmap.go +++ b/src/runtime/mbitmap.go @@ -147,7 +147,7 @@ func (s *mspan) nextFreeIndex() uintptr { aCache := s.allocCache - bitIndex := sys.Ctz64(aCache) + bitIndex := sys.TrailingZeros64(aCache) for bitIndex == 64 { // Move index to start of next cached bits. sfreeindex = (sfreeindex + 64) &^ (64 - 1) @@ -159,7 +159,7 @@ func (s *mspan) nextFreeIndex() uintptr { // Refill s.allocCache with the next 64 alloc bits. s.refillAllocCache(whichByte) aCache = s.allocCache - bitIndex = sys.Ctz64(aCache) + bitIndex = sys.TrailingZeros64(aCache) // nothing available in cached bits // grab the next 8 bytes and try again. } @@ -452,9 +452,9 @@ func (h heapBits) next() (heapBits, uintptr) { if h.mask != 0 { var i int if goarch.PtrSize == 8 { - i = sys.Ctz64(uint64(h.mask)) + i = sys.TrailingZeros64(uint64(h.mask)) } else { - i = sys.Ctz32(uint32(h.mask)) + i = sys.TrailingZeros32(uint32(h.mask)) } h.mask ^= uintptr(1) << (i & (ptrBits - 1)) return h, h.addr + uintptr(i)*goarch.PtrSize @@ -494,9 +494,9 @@ func (h heapBits) nextFast() (heapBits, uintptr) { // BSFQ var i int if goarch.PtrSize == 8 { - i = sys.Ctz64(uint64(h.mask)) + i = sys.TrailingZeros64(uint64(h.mask)) } else { - i = sys.Ctz32(uint32(h.mask)) + i = sys.TrailingZeros32(uint32(h.mask)) } // BTCQ h.mask ^= uintptr(1) << (i & (ptrBits - 1)) |
