diff options
author | Rhys Perry <pendingchaos02@gmail.com> | 2020-08-06 14:53:36 +0100 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-08-20 10:52:19 +0000 |
commit | 391eeb744356353e96ce34f23b8b16b718a02d61 (patch) | |
tree | 1880476b06355fd62314a5ac6b4acd0af042c21a /src/util | |
parent | 721cb6cc07978259e055c5c7ff7093819b18e8b5 (diff) |
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>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/macros.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/macros.h b/src/util/macros.h index 04aec96b546..f9aa478c994 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -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 */ |