From: RĂ©mi Denis-Courmont Date: Sat, 17 Jan 2009 12:05:28 +0000 (+0200) Subject: Assert proper alignment of the atomic reference counter X-Git-Tag: 1.0.0-pre1~1303 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=2a6fb859cc42d3af9c237da964db22609b784038;p=vlc Assert proper alignment of the atomic reference counter --- diff --git a/src/libvlc.c b/src/libvlc.c index c1212446fd..c74a681654 100644 --- a/src/libvlc.c +++ b/src/libvlc.c @@ -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);