From fcb09f5e2885c7e70df098bfb71a5de38ee02f71 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Thu, 4 Nov 2021 20:36:02 -0300 Subject: [PATCH] Texture alignment macros (#284) * Add ALIGNED8 * Add designated initializer macro * Update include/command_macros_base.h Co-authored-by: rylieb <31797144+rylieb@users.noreply.github.com> * Remove braces Co-authored-by: rylieb <31797144+rylieb@users.noreply.github.com> --- include/command_macros_base.h | 10 ++++++++-- include/macros.h | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/command_macros_base.h b/include/command_macros_base.h index c0d2ac4e89..bb5ce16485 100644 --- a/include/command_macros_base.h +++ b/include/command_macros_base.h @@ -3,7 +3,7 @@ /** * Command Base macros intended for use in designing of more specific command macros - * Each macro packs bytes (B), halfowrds (H) and words (W, for consistency) into a single word + * Each macro packs bytes (B), halfwords (H) and words (W, for consistency) into a single word */ #define CMD_BBBB(a, b, c, d) (_SHIFTL(a, 24, 8) | _SHIFTL(b, 16, 8) | _SHIFTL(c, 8, 8) | _SHIFTL(d, 0, 8)) @@ -16,6 +16,12 @@ #define CMD_W(a) (a) -#define CMD_PTR(a) (u32)(a) +#ifdef __GNUC__ +#define CMD_F(a) {.f = (a)} +#else +#define CMD_F(a) {(a)} +#endif + +#define CMD_PTR(a) (uintptr_t)(a) #endif diff --git a/include/macros.h b/include/macros.h index 7020fc01c4..7dd84fc8ee 100644 --- a/include/macros.h +++ b/include/macros.h @@ -139,4 +139,10 @@ extern GraphicsContext* __gfxCtx; (b) = _temp; \ } +#ifdef __GNUC__ +#define ALIGNED8 __attribute__ ((aligned (8))) +#else +#define ALIGNED8 +#endif + #endif // _MACROS_H_