evcc-io/core/math.go
2020-11-26 08:49:00 +01:00

12 lines
176 B
Go

package core
// clamp calculates minimum of two integer values
func clamp(x, min, max int64) int64 {
if x <= min {
return min
}
if x >= max {
return max
}
return x
}