util: add a alignof() macro

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6206>
This commit is contained in:
Rhys Perry
2020-08-06 14:53:36 +01:00
committed by Marge Bot
parent 721cb6cc07
commit 391eeb7443

View File

@@ -351,4 +351,14 @@ enum pipe_debug_type
PIPE_DEBUG_TYPE_CONFORMANCE,
};
#if !defined(alignof) && !defined(__cplusplus)
#if __STDC_VERSION__ >= 201112L
#define alignof(t) _Alignof(t)
#elif defined(_MSC_VER)
#define alignof(t) __alignof(t)
#else
#define alignof(t) __alignof__(t)
#endif
#endif
#endif /* UTIL_MACROS_H */