Clean up AVOID_UB ifdefs

This commit is contained in:
Arceveti
2021-09-22 11:35:17 -07:00
parent f40a1978d9
commit 5afa901fcf
35 changed files with 26 additions and 275 deletions

View File

@@ -21,23 +21,13 @@
#define DEBUG_ASSERT(exp)
#endif
// Pointer casting is technically UB, and avoiding it gets rid of endian issues
// as well as a nice side effect.
#ifdef AVOID_UB
// Pointer casting is technically UB, and avoiding it gets rid of endian issues as well as a nice side effect.
#define GET_HIGH_U16_OF_32(var) ((u16)((var) >> 16))
#define GET_HIGH_S16_OF_32(var) ((s16)((var) >> 16))
#define GET_LOW_U16_OF_32(var) ((u16)((var) & 0xFFFF))
#define GET_LOW_S16_OF_32(var) ((s16)((var) & 0xFFFF))
#define SET_HIGH_U16_OF_32(var, x) ((var) = ((var) & 0xFFFF) | ((x) << 16))
#define SET_HIGH_S16_OF_32(var, x) ((var) = ((var) & 0xFFFF) | ((x) << 16))
#else
#define GET_HIGH_U16_OF_32(var) (((u16 *)&(var))[0])
#define GET_HIGH_S16_OF_32(var) (((s16 *)&(var))[0])
#define GET_LOW_U16_OF_32(var) (((u16 *)&(var))[1])
#define GET_LOW_S16_OF_32(var) (((s16 *)&(var))[1])
#define SET_HIGH_U16_OF_32(var, x) ((((u16 *)&(var))[0]) = (x))
#define SET_HIGH_S16_OF_32(var, x) ((((s16 *)&(var))[0]) = (x))
#endif
// Layers
#if SILHOUETTE

View File

@@ -255,11 +255,7 @@ f32 gSineTable[] = {
0.999830604f, 0.999857664f, 0.999882340f, 0.999904692f,
0.999924719f, 0.999942362f, 0.999957621f, 0.999970615f,
0.999981165f, 0.999989390f, 0.999995291f, 0.999998808f,
#ifndef AVOID_UB
};
f32 gCosineTable[0x1000] = {
#endif
// cosine
1.000000000f, 0.999998808f, 0.999995291f, 0.999989390f,
0.999981165f, 0.999970615f, 0.999957621f, 0.999942362f,