summaryrefslogtreecommitdiffstats
path: root/src/common/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/utils.c')
-rw-r--r--src/common/utils.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/common/utils.c b/src/common/utils.c
new file mode 100644
index 0000000..7bcf767
--- /dev/null
+++ b/src/common/utils.c
@@ -0,0 +1,22 @@
+#include "utils.h"
+
+fpi1_t add(fpi1_t a, fpi1_t b)
+{
+ return a + b;
+}
+
+fpi1_t sub(fpi1_t a, fpi1_t b)
+{
+ return a - b;
+}
+
+fpi1_t mul(fpi1_t a, fpi1_t b)
+{
+ return (fpi1_t)(((long)a * (long)b) / 100);
+}
+
+fpi1_t div(fpi1_t a, fpi1_t b)
+{
+ return (fpi1_t)(((long)a * 10) / ((long)b * 10));
+}
+