Detect potential misalignment in modern
This commit is contained in:
@@ -27,10 +27,32 @@ u16 ArcTan2(s16 x, s16 y);
|
||||
|
||||
void CpuSet(const void *src, void *dest, u32 control);
|
||||
|
||||
#if MODERN
|
||||
// NOTE: Assumes 16-bit CpuSets unless control is a constant and has
|
||||
// CPU_SET_32BIT set.
|
||||
#define CpuSet(src, dest, control) \
|
||||
do \
|
||||
{ \
|
||||
_Static_assert(_Alignof(src) >= __builtin_choose_expr(__builtin_constant_p(control), ((control) & CPU_SET_32BIT) ? 4 : 2, 2), "source potentially unaligned"); \
|
||||
_Static_assert(_Alignof(dest) >= __builtin_choose_expr(__builtin_constant_p(control), ((control) & CPU_SET_32BIT) ? 4 : 2, 2), "destination potentially unaligned"); \
|
||||
CpuSet(src, dest, control); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#define CPU_FAST_SET_SRC_FIXED 0x01000000
|
||||
|
||||
void CpuFastSet(const void *src, void *dest, u32 control);
|
||||
|
||||
#if MODERN
|
||||
#define CpuFastSet(src, dest, control) \
|
||||
do \
|
||||
{ \
|
||||
_Static_assert(_Alignof(src) >= 4, "source potentially unaligned"); \
|
||||
_Static_assert(_Alignof(dest) >= 4, "destination potentially unaligned"); \
|
||||
CpuFastSet(src, dest, control); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
void BgAffineSet(struct BgAffineSrcData *src, struct BgAffineDstData *dest, s32 count);
|
||||
|
||||
void ObjAffineSet(struct ObjAffineSrcData *src, void *dest, s32 count, s32 offset);
|
||||
|
||||
Reference in New Issue
Block a user