mirror of
https://github.com/golang/go
synced 2024-11-17 05:54:46 -07:00
cmd/compile: remove manually implemented popcount in _gen/main.go
Change-Id: I7b4da26bace15c2b632c2dbfe56cc2799bbfdb02 Reviewed-on: https://go-review.googlesource.com/c/go/+/450058 Reviewed-by: Martin Möhrmann <moehrmann@google.com> Reviewed-by: 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>
This commit is contained in:
parent
362713183a
commit
b4ff479298
@ -12,6 +12,7 @@ import (
|
||||
"fmt"
|
||||
"go/format"
|
||||
"log"
|
||||
"math/bits"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
@ -546,12 +547,7 @@ func (a arch) Name() string {
|
||||
|
||||
// countRegs returns the number of set bits in the register mask.
|
||||
func countRegs(r regMask) int {
|
||||
n := 0
|
||||
for r != 0 {
|
||||
n += int(r & 1)
|
||||
r >>= 1
|
||||
}
|
||||
return n
|
||||
return bits.OnesCount64(uint64(r))
|
||||
}
|
||||
|
||||
// for sorting a pair of integers by key
|
||||
|
Loading…
Reference in New Issue
Block a user