diff options
| author | Tyler McGavran <tyler.taggerung@gmail.com> | 2022-01-18 07:46:58 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-18 05:46:58 -0700 |
| commit | e413e2ec00236b11a49b3ca4b856318df7d08b4c (patch) | |
| tree | 73dc041df0749f0f5b33142c51a09e8dd26bc2ad /include | |
| parent | 5e577b8999ba1ba988609df490499270b74848ff (diff) | |
Match 4 functions in math_util, do some tidying up of imports for math_util (#144)
* Match func_802B5450, func_802B5F00, func_802B71CC
* Match func_802B4FF8
Also do some import fixing
Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/trig_tables.h | 25 | ||||
| -rw-r--r-- | include/variables.h | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/include/trig_tables.h b/include/trig_tables.h new file mode 100644 index 000000000..b209dfb59 --- /dev/null +++ b/include/trig_tables.h @@ -0,0 +1,25 @@ +#ifndef TRIG_TABLES_H
+#define TRIG_TABLES_H
+
+/*
+ * The sine and cosine tables overlap, but "#define gCosineTable (gSineTable +
+ * 0x400)" doesn't give expected codegen; gSineTable and gCosineTable need to
+ * be different symbols for code to match. Most likely the tables were placed
+ * adjacent to each other, and gSineTable cut short, such that reads overflow
+ * into gCosineTable.
+ *
+ * These kinds of out of bounds reads are undefined behavior, and break on
+ * e.g. GCC (which doesn't place the tables next to each other, and probably
+ * exploits array sizes for range analysis-based optimizations as well).
+ * Thus, for non-IDO compilers we use the standard-compliant version.
+ */
+extern f32 gSineTable[];
+#ifdef AVOID_UB
+#define gCosineTable (gSineTable + 0x400)
+#else
+extern f32 gCosineTable[];
+#endif
+
+extern s16 gArctanTable[];
+
+#endif
diff --git a/include/variables.h b/include/variables.h index a1257d3bb..f528da7b1 100644 --- a/include/variables.h +++ b/include/variables.h @@ -108,6 +108,8 @@ extern s32 gActiveScreenMode; // D_800DC52C extern s32 D_800DC540; extern u16 D_800DC5FC; +extern u16 D_80150112; + extern u16 D_8015F890; extern u16 D_80162DD4[]; |
