diff options
author | wm4 <wm4@nowhere> | 2017-11-30 01:14:33 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-11-30 01:20:03 +0100 |
commit | 6f8cf73f54c4b1f80d69ecd30d269f16df70ef6e (patch) | |
tree | 48cc61b0f1f0196b27b8381f840a42cb47bfafa9 /osdep/atomic.h | |
parent | 963eb15006342b694a9b396af596a4f049acb23a (diff) | |
download | mpv-6f8cf73f54c4b1f80d69ecd30d269f16df70ef6e.tar.bz2 mpv-6f8cf73f54c4b1f80d69ecd30d269f16df70ef6e.tar.xz |
ao: simplify hack for float atomics
stdatomic.h defines no atomic_float typedef. We can't just use _Atomic
unconditionally, because we support compilers without C11 atomics. So
just create a custom atomic_float typedef in the wrapper, which uses
_Atomic in the C11 code path.
Diffstat (limited to 'osdep/atomic.h')
-rw-r--r-- | osdep/atomic.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/osdep/atomic.h b/osdep/atomic.h index 1d3e158afa..a5608fa78a 100644 --- a/osdep/atomic.h +++ b/osdep/atomic.h @@ -24,6 +24,7 @@ #if HAVE_STDATOMIC #include <stdatomic.h> +typedef _Atomic float mp_atomic_float; #else // Emulate the parts of C11 stdatomic.h needed by mpv. @@ -36,6 +37,8 @@ typedef struct { long long v; } atomic_llong; typedef struct { uint_least32_t v; } atomic_uint_least32_t; typedef struct { unsigned long long v; } atomic_ullong; +typedef struct { float v; } mp_atomic_float; + #define ATOMIC_VAR_INIT(x) \ {.v = (x)} |