aboutsummaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index 4f75298..4813da5 100644
--- a/utils.c
+++ b/utils.c
@@ -2,6 +2,12 @@
#include <libc.h>
#include <draw.h>
+int
+clamp(int n, int min, int max)
+{
+ return n < min? min: n > max? max: n;
+}
+
double
fclamp(double n, double min, double max)
{