mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphics: isPowerOf2(0 or negative) should return false
This commit is contained in:
parent
17b225083d
commit
5f8a0e34bb
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user