37 lines
487 B
Go
37 lines
487 B
Go
package table
|
|
|
|
// Keep compatibility with Go 1.21 by re-declaring min.
|
|
//
|
|
//nolint:predeclared
|
|
func min(x, y int) int {
|
|
if x < y {
|
|
return x
|
|
}
|
|
|
|
return y
|
|
}
|
|
|
|
// Keep compatibility with Go 1.21 by re-declaring max.
|
|
//
|
|
//nolint:predeclared
|
|
func max(x, y int) int {
|
|
if x > y {
|
|
return x
|
|
}
|
|
|
|
return y
|
|
}
|
|
|
|
// These var names are fine for this little function
|
|
//
|
|
//nolint:varnamelen
|
|
func gcd(x, y int) int {
|
|
if x == 0 {
|
|
return y
|
|
} else if y == 0 {
|
|
return x
|
|
}
|
|
|
|
return gcd(y%x, x)
|
|
}
|