aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2020-06-14 22:28:38 +0000
committerrodri <rgl@antares-labs.eu>2020-06-14 22:28:38 +0000
commit35490e9f73c182b844b1a32599aa105562e9f455 (patch)
tree4f9a0ac99c34c3a07e4d01e338d9090f7f7e7aff
parent1024676bc6ad5ef8b073cefd5da22c89dbb59dde (diff)
downloadpuppeteer-35490e9f73c182b844b1a32599aa105562e9f455.tar.gz
puppeteer-35490e9f73c182b844b1a32599aa105562e9f455.tar.bz2
puppeteer-35490e9f73c182b844b1a32599aa105562e9f455.zip
forgot the utils file.
-rw-r--r--utils.c18
1 files changed, 18 insertions, 0 deletions
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 <u.h>
+#include <libc.h>
+#include <draw.h>
+
+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;
+}