summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-05-20 20:47:43 +0200
committerwm4 <wm4@nowhere>2018-05-24 19:56:35 +0200
commit707b404820a56ca3dfa22fc5f18e68186dbae51d (patch)
tree1185c8bc5271ef31ac2fd928cde3b7a33bfb8d66 /osdep
parentaf4fe28af7e207bb46d5bdb7a0ee3cb97989033a (diff)
downloadmpv-707b404820a56ca3dfa22fc5f18e68186dbae51d.tar.bz2
mpv-707b404820a56ca3dfa22fc5f18e68186dbae51d.tar.xz
osdep: add portable C11-like alignof() macro
Diffstat (limited to 'osdep')
-rw-r--r--osdep/compiler.h5
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