aboutsummaryrefslogtreecommitdiff
path: root/shared/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'shared/util.h')
-rw-r--r--shared/util.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/shared/util.h b/shared/util.h
new file mode 100644
index 0000000..9e4d8ac
--- /dev/null
+++ b/shared/util.h
@@ -0,0 +1,7 @@
+#pragma once
+
+#define W2_MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define W2_MAX(a, b) (((a) > (b)) ? (a) : (b))
+#define W2_RANGE(min, val, max) W2_MIN(max, W2_MAX(val, min))
+
+unsigned long w2_util_exp_mov_avg(unsigned long current_avg, unsigned long new_meas);