diff --git a/programs/cmm/lib/math.h b/programs/cmm/lib/math.h index 09f50917e..1f0ccb94c 100644 --- a/programs/cmm/lib/math.h +++ b/programs/cmm/lib/math.h @@ -20,6 +20,7 @@ signed ceil(float x); signed min(signed i1, i2); signed max(signed i1, i2); + signed in(signed base, min1, max1); }math; :signed MATH::round(float x) @@ -109,4 +110,10 @@ else return i2; } +:signed MATH::in(signed base, min1, max1) +{ + if (base > max1) return max1; + if (base < min1) return min1; + return base; +} #endif \ No newline at end of file