mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
graphics: Speed optimization at maxf32 and minf32
This commit is contained in:
parent
5e6bdc25e5
commit
df9458510d
32
mipmap.go
32
mipmap.go
@ -372,22 +372,30 @@ func pow2(power int) float32 {
|
||||
return x
|
||||
}
|
||||
|
||||
func maxf32(values ...float32) float32 {
|
||||
max := float32(math.Inf(-1))
|
||||
for _, v := range values {
|
||||
if max < v {
|
||||
max = v
|
||||
}
|
||||
func maxf32(a, b, c, d float32) float32 {
|
||||
max := a
|
||||
if max < b {
|
||||
max = b
|
||||
}
|
||||
if max < c {
|
||||
max = c
|
||||
}
|
||||
if max < d {
|
||||
max = d
|
||||
}
|
||||
return max
|
||||
}
|
||||
|
||||
func minf32(values ...float32) float32 {
|
||||
min := float32(math.Inf(1))
|
||||
for _, v := range values {
|
||||
if min > v {
|
||||
min = v
|
||||
}
|
||||
func minf32(a, b, c, d float32) float32 {
|
||||
min := a
|
||||
if min > b {
|
||||
min = b
|
||||
}
|
||||
if min > c {
|
||||
min = c
|
||||
}
|
||||
if min > d {
|
||||
min = d
|
||||
}
|
||||
return min
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user