func onesCount(x int) (ones int) {
for ; x > 0 ; x &= x - 1 {
ones++
}
return
}
求1比特数
于 2021-09-11 15:35:16 首次发布
func onesCount(x int) (ones int) {
for ; x > 0 ; x &= x - 1 {
ones++
}
return
}