remove ginext/mongoext (no-dep lib)

This commit is contained in:
2022-10-27 16:07:42 +02:00
parent 568d7bd5e3
commit 47f123b86f
31 changed files with 6 additions and 123 deletions

41
mathext/clamp.go Normal file
View File

@@ -0,0 +1,41 @@
package mathext
func ClampInt(v int, lo int, hi int) int {
if v < lo {
return lo
} else if v > hi {
return hi
} else {
return v
}
}
func ClampInt32(v int32, lo int32, hi int32) int32 {
if v < lo {
return lo
} else if v > hi {
return hi
} else {
return v
}
}
func ClampFloat32(v float32, lo float32, hi float32) float32 {
if v < lo {
return lo
} else if v > hi {
return hi
} else {
return v
}
}
func ClampFloat64(v float64, lo float64, hi float64) float64 {
if v < lo {
return lo
} else if v > hi {
return hi
} else {
return v
}
}