diff options
-rw-r--r-- | utils.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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; +} |