File tree 1 file changed +5
-5
lines changed
src/cmd/compile/internal/ssa
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -395,11 +395,11 @@ func ntz32(x int32) int { return bits.TrailingZeros32(uint32(x)) }
395
395
func ntz16 (x int16 ) int { return bits .TrailingZeros16 (uint16 (x )) }
396
396
func ntz8 (x int8 ) int { return bits .TrailingZeros8 (uint8 (x )) }
397
397
398
- func oneBit (x int64 ) bool { return bits . OnesCount64 ( uint64 ( x )) == 1 }
399
- func oneBit8 (x int8 ) bool { return bits . OnesCount8 ( uint8 ( x )) == 1 }
400
- func oneBit16 (x int16 ) bool { return bits . OnesCount16 ( uint16 ( x )) == 1 }
401
- func oneBit32 (x int32 ) bool { return bits . OnesCount32 ( uint32 ( x )) == 1 }
402
- func oneBit64 (x int64 ) bool { return bits . OnesCount64 ( uint64 ( x )) == 1 }
398
+ func oneBit (x int64 ) bool { return x & ( x - 1 ) == 0 }
399
+ func oneBit8 (x int8 ) bool { return x & ( x - 1 ) == 0 }
400
+ func oneBit16 (x int16 ) bool { return x & ( x - 1 ) == 0 }
401
+ func oneBit32 (x int32 ) bool { return x & ( x - 1 ) == 0 }
402
+ func oneBit64 (x int64 ) bool { return x & ( x - 1 ) == 0 }
403
403
404
404
// nlo returns the number of leading ones.
405
405
func nlo (x int64 ) int64 {
You can’t perform that action at this time.
0 commit comments