This commit is contained in:
huangsimin
2019-05-20 19:12:38 +08:00
parent 8d5b098286
commit a02f238ff1
3 changed files with 37 additions and 1 deletions

9
utils/math.go Normal file
View File

@@ -0,0 +1,9 @@
package utils
var bit = uint(32 << (^uint(0) >> 63))
var bitsub1 = bit - 1
func AbsInt(n int) uint {
y := n >> bitsub1
return uint((n ^ y) - y)
}