aboutsummaryrefslogtreecommitdiff
path: root/maths.h
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-09-23 21:11:29 +1000
committerquou <quou@disroot.org>2024-09-23 21:11:29 +1000
commit259237fae792e8f19d9b7920b2354f75bc1789e2 (patch)
treeaf079430f30f7df1b76efc4f96f520b0b6eee0af /maths.h
initial commit, basic platform and rendering code.
Diffstat (limited to 'maths.h')
-rw-r--r--maths.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/maths.h b/maths.h
new file mode 100644
index 0000000..bd87839
--- /dev/null
+++ b/maths.h
@@ -0,0 +1,22 @@
+#ifndef maths_h
+#define maths_h
+
+#define mini(a_, b_) ((a_) < (b_) ? (a_) : (b_))
+#define maxi(a_, b_) ((a_) > (b_) ? (a_) : (b_))
+#define clamp(v_, min_, max_) (maxi(min_, mini(max_, v_)))
+#define absolute(v_) ((v_) < 0? -(v_): (v_))
+
+#define fbits 0x9
+#define f1 0x200
+
+#define sin_table_count 0x100
+#define sin_table_mask 0x0ff
+#define sqrt_table_count 0x800
+#define sqrt_table_mask 0x07f
+
+extern int sin_table[sin_table_count];
+extern int cos_table[sin_table_count];
+
+void init_maths(void);
+
+#endif