Commit 2a6fb859 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Assert proper alignment of the atomic reference counter

parent 0051f028
......@@ -146,6 +146,7 @@ void *vlc_hold (gc_object_t * p_gc)
{
uintptr_t refs;
assert( p_gc );
assert ((((uintptr_t)&refs) & (sizeof (void *) - 1)) == 0); /* alignment */
#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
refs = __sync_add_and_fetch (&p_gc->refs, 1);
......@@ -173,6 +174,7 @@ void vlc_release (gc_object_t *p_gc)
unsigned refs;
assert( p_gc );
assert ((((uintptr_t)&refs) & (sizeof (void *) - 1)) == 0); /* alignment */
#if defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
refs = __sync_sub_and_fetch (&p_gc->refs, 1);
......
Markdown is supported
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