summaryrefslogtreecommitdiff
path: root/src/include/toxic
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/toxic')
-rw-r--r--src/include/toxic/math.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/include/toxic/math.h b/src/include/toxic/math.h
new file mode 100644
index 0000000..acae3fe
--- /dev/null
+++ b/src/include/toxic/math.h
@@ -0,0 +1,14 @@
+#ifndef MATH_H
+#define MATH_H
+
+#include <stdint.h>
+
+/* This should check for overflow */
+static inline uint32_t
+roundup32(uint32_t n, uint32_t alignment)
+{
+ return (n % alignment == 0) ? n :
+ (n + (alignment - ( n % alignment)));
+}
+
+#endif /* MATH_H */