1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-29 03:34:07 +00:00
oot/include/alignment.h
Tharo c521f1f8ae
Remove gSystemHeap and use _buffersSegmentEnd instead, make buffer alignments explicit for gcc (#1901)
* Remove gSystemHeap and use _buffersSegmentEnd instead, make buffer alignments explicit for gcc

* ALIGNEDn -> ALIGNED(n), reposition alignment attribute for PreNmiBuff

* Correct positioning of ALIGNED for filter data in audio/lib/data.c

* Add ALIGNED to TypenameMacros

* ALIGNED(4) on same line for PreNmiBuff

* Revert audio load.c change, to be submitted separately
2024-02-27 19:01:47 -05:00

28 lines
666 B
C

#ifndef ALIGNMENT_H
#define ALIGNMENT_H
#define ALIGN8(val) (((val) + 7) & ~7)
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
#define ALIGN32(val) (((val) + 0x1F) & ~0x1F)
#define ALIGN64(val) (((val) + 0x3F) & ~0x3F)
#define ALIGN256(val) (((val) + 0xFF) & ~0xFF)
#ifdef __GNUC__
#define ALIGNED(n) __attribute__ ((aligned (n)))
#else
#define ALIGNED(n)
#endif
#ifdef __sgi /* IDO compiler */
#define ALIGNOF(x) __builtin_alignof(x)
#elif (__STDC_VERSION__ >= 201112L) /* C11 */
#define ALIGNOF(x) _Alignof(x)
#else /* __GNUC__ */
#define ALIGNOF(x) __alignof__(x)
#endif
#define ALIGN_MASK(n) (~((n) - 1))
#define ALIGNOF_MASK(x) ALIGN_MASK(ALIGNOF(x))
#endif