diff options
author | wm4 <wm4@nowhere> | 2018-05-20 20:47:43 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2018-05-24 19:56:35 +0200 |
commit | 707b404820a56ca3dfa22fc5f18e68186dbae51d (patch) | |
tree | 1185c8bc5271ef31ac2fd928cde3b7a33bfb8d66 | |
parent | af4fe28af7e207bb46d5bdb7a0ee3cb97989033a (diff) | |
download | mpv-707b404820a56ca3dfa22fc5f18e68186dbae51d.tar.bz2 mpv-707b404820a56ca3dfa22fc5f18e68186dbae51d.tar.xz |
osdep: add portable C11-like alignof() macro
-rw-r--r-- | osdep/compiler.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/osdep/compiler.h b/osdep/compiler.h index d25f0cd1e4..7c9f859f3a 100644 --- a/osdep/compiler.h +++ b/osdep/compiler.h @@ -17,5 +17,10 @@ #define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (gnu_printf, a1, a2))) #endif +#if __STDC_VERSION__ >= 201112L +#include <stdalign.h> +#else +#define alignof(x) (offsetof(struct {char unalign_; x u;}, u)) +#endif #endif |