Commit 1252a5eb authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Add helpers to store floats into vlc_atomic_t

(Lets assume that uintptr_t is big enough, i.e. 32-bits).
parent aa7fcdb1
......@@ -53,4 +53,21 @@ static inline uintptr_t vlc_atomic_dec (vlc_atomic_t *atom)
VLC_API uintptr_t vlc_atomic_swap(vlc_atomic_t *, uintptr_t);
VLC_API uintptr_t vlc_atomic_compare_swap(vlc_atomic_t *, uintptr_t, uintptr_t);
/** Helper to retrieve a single precision from an atom. */
static inline float vlc_atomic_getf(const vlc_atomic_t *atom)
union { float f; uintptr_t i; } u;
u.i = vlc_atomic_get(atom);
return u.f;
/** Helper to store a single precision into an atom. */
static inline float vlc_atomic_setf(vlc_atomic_t *atom, float f)
union { float f; uintptr_t i; } u;
u.f = f;
vlc_atomic_set(atom, u.i);
return f;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment