util: use c11 alignof instead of our own

...with an exception for MSVC, which doesn't have stdalign.h, so let's
add a definition for that.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16908>
This commit is contained in:
Erik Faye-Lund 2022-06-07 16:33:02 +02:00 committed by Marge Bot
parent e83f13c04e
commit 3a62badb2e
1 changed files with 4 additions and 6 deletions

View File

@ -410,13 +410,11 @@ u_uintN_max(unsigned bit_size)
return UINT64_MAX >> (64 - bit_size);
}
#if !defined(alignof) && !defined(__cplusplus)
#if __STDC_VERSION__ >= 201112L
#define alignof(t) _Alignof(t)
#elif defined(_MSC_VER)
#define alignof(t) __alignof(t)
#ifndef __cplusplus
#ifdef _MSC_VER
#define alignof _Alignof
#else
#define alignof(t) __alignof__(t)
#include <stdalign.h>
#endif
#endif