summaryrefslogtreecommitdiff
path: root/include/global.h
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2021-06-23 15:08:21 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2021-06-23 15:08:21 -0400
commit5dd61a98b8df5743b8439633f9b0a042b5f7015d (patch)
treed197489b16d933ad8992e36f544a46c86b1ea92b /include/global.h
parent21822dcdbd17ec3c0a435e060dc90d808ca53553 (diff)
Contest data and strings to C, 2
Diffstat (limited to 'include/global.h')
-rw-r--r--include/global.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/global.h b/include/global.h
index 018db2725..96756b7a4 100644
--- a/include/global.h
+++ b/include/global.h
@@ -95,6 +95,18 @@ enum
(ptr)[3] = ((value) >> 24) & 0xFF;\
})
+// Converts a number to Q8.8 fixed-point format
+#define Q_8_8(n) ((s16)((n) * 256))
+
+// Converts a number from Q8.8 fixed-point format to integer
+#define Q_8_8_TO_INT(n) ((s16)((n) >> 8))
+
+// Converts a number to Q4.12 fixed-point format
+#define Q_4_12(n) ((s16)((n) * 4096))
+
+// Converts a number from Q4.12 fixed-point format to integer
+#define Q_4_12_TO_INT(n) ((s16)((n) >> 12))
+
// Credits to Made (dolphin emoji)
#define S16TOPOSFLOAT(val) \
({ \