go bug

func ConstantTimeLessOrEq(x, y int) int {
x32 := int32(x)
y32 := int32(y)
return int((((x32 - y32 - 1) | (x32 >> 31) - (y32 >> 31)) >> 31) & 1)
}

func main() {
a := 1
b := -3
r := ConstantTimeLessOrEq(a, b)
fmt.Println(r)
}


https://github.com/golang/go/issues/42685
posted @ 2020-12-09 14:02  zJanly  阅读(156)  评论(0编辑  收藏  举报