From 35490e9f73c182b844b1a32599aa105562e9f455 Mon Sep 17 00:00:00 2001 From: rodri Date: Sun, 14 Jun 2020 22:28:38 +0000 Subject: forgot the utils file. --- utils.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 utils.c diff --git a/utils.c b/utils.c new file mode 100644 index 0000000..4f75298 --- /dev/null +++ b/utils.c @@ -0,0 +1,18 @@ +#include +#include +#include + +double +fclamp(double n, double min, double max) +{ + return n < min? min: n > max? max: n; +} + +int +alphachan(ulong chan) +{ + for(; chan; chan >>= 8) + if(TYPE(chan) == CAlpha) + return 1; + return 0; +} -- cgit v1.2.3