all: use Go 1.21's min/max builtin functions

This commit is contained in:
Hajime Hoshi
2024-09-12 00:58:15 +09:00
parent a36f6210c0
commit a4bfa6cb15
14 changed files with 2 additions and 131 deletions

View File

@@ -163,19 +163,9 @@ func loadImage(data []byte) (*ebiten.Image, error) {
}
// max returns the largest of x or y.
func max(x, y int) int {
if x > y {
return x
}
return y
}
// maxSide returns the largest side of a or b images.
func maxSide(a, b *ebiten.Image) int {
return max(
max(a.Bounds().Dx(), b.Bounds().Dx()),
max(a.Bounds().Dy(), b.Bounds().Dy()),
)
return max(a.Bounds().Dx(), b.Bounds().Dx(), a.Bounds().Dy(), b.Bounds().Dy())
}
// drawCenteredText is a util function for drawing blend mode description.