summaryrefslogtreecommitdiff
path: root/include/alignment.h
diff options
context:
space:
mode:
authorTharo <17233964+Thar0@users.noreply.github.com>2022-11-13 23:29:50 +0000
committerGitHub <noreply@github.com>2022-11-13 18:29:50 -0500
commit6d5287ff12919332eff421ad833ba0b7421f6158 (patch)
tree3bd8c2df770b116363169b029075a6f398f9a980 /include/alignment.h
parentc165ed015c8cbd379fafaad11146bf909aedf647 (diff)
TwoHeadArena and TwoHeadGfxArena docs (#1349)
* TwoHeadArena and TwoHeadGfxArena docs, ALIGNOF macro * AllocStart -> AllocHead , AllocEnd -> AllocTail * Format * Suggested changes * Fix * Further suggested changes
Diffstat (limited to 'include/alignment.h')
-rw-r--r--include/alignment.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/alignment.h b/include/alignment.h
index 7a3b94ea2..e26a1d3f3 100644
--- a/include/alignment.h
+++ b/include/alignment.h
@@ -13,4 +13,16 @@
#define ALIGNED8
#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