[vlc-devel] commit: Assert proper alignment of the atomic reference counter ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jan 17 13:06:45 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Jan 17 14:05:28 2009 +0200| [2a6fb859cc42d3af9c237da964db22609b784038] | committer: Rémi Denis-Courmont 

Assert proper alignment of the atomic reference counter

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2a6fb859cc42d3af9c237da964db22609b784038
---

 src/libvlc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/libvlc.c b/src/libvlc.c
index c121244..c74a681 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);




More information about the vlc-devel mailing list