graphics: isPowerOf2(0 or negative) should return false

This commit is contained in:
Hajime Hoshi 2018-12-16 14:22:47 +09:00
parent 17b225083d
commit 5f8a0e34bb

View File

@ -50,6 +50,9 @@ func (v *verticesBackend) slice(n int) []float32 {
}
func isPowerOf2(x int) bool {
if x <= 0 {
return false
}
return (x & (x - 1)) == 0
}