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:
@@ -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 */
|
||||
|
Reference in New Issue
Block a user