Mario Kart 64
Loading...
Searching...
No Matches
trig_tables.h
Go to the documentation of this file.
1
#ifndef TRIG_TABLES_H
2
#define TRIG_TABLES_H
3
4
/*
5
* The sine and cosine tables overlap, but "#define gCosineTable (gSineTable +
6
* 0x400)" doesn't give expected codegen; gSineTable and gCosineTable need to
7
* be different symbols for code to match. Most likely the tables were placed
8
* adjacent to each other, and gSineTable cut short, such that reads overflow
9
* into gCosineTable.
10
*
11
* These kinds of out of bounds reads are undefined behavior, and break on
12
* e.g. GCC (which doesn't place the tables next to each other, and probably
13
* exploits array sizes for range analysis-based optimizations as well).
14
* Thus, for non-IDO compilers we use the standard-compliant version.
15
*/
16
extern
f32
gSineTable
[];
17
#ifdef AVOID_UB
18
#define gCosineTable (gSineTable + 0x400)
19
#else
20
extern
f32
gCosineTable
[];
21
#endif
22
23
extern
s16
gArctanTable
[];
24
25
#endif
gSineTable
f32 gSineTable[]
Definition
trig_tables.c:4
gCosineTable
f32 gCosineTable[0x1000]
Definition
trig_tables.c:136
gArctanTable
s16 gArctanTable[0x401]
Definition
trig_tables.c:4243
src
buffers
trig_tables.h
Generated by
1.13.2