summaryrefslogtreecommitdiff
path: root/source/math.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/math.h')
-rwxr-xr-xsource/math.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/math.h b/source/math.h
index be1432f..950593d 100755
--- a/source/math.h
+++ b/source/math.h
@@ -33,6 +33,19 @@ r32 clampf(r32 x, r32 bottom, r32 top)
return x;
}
+u32 clampi(u32 x, u32 bottom, u32 top)
+{
+ if (x < bottom)
+ {
+ x = bottom;
+ }
+ else if (x > top)
+ {
+ x = top;
+ }
+
+ return x;
+}
// ==== Vector Math ====
union IVec2 {