[glib/glib-2-30] Fix 1bit mutex test on platforms with 32 bit aligned pointers



commit 439f3b8e540a43b5edccebd8d3acc2444d82fc8c
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Sun Nov 13 17:49:57 2011 +0100

    Fix 1bit mutex test on platforms with 32 bit aligned pointers
    
    The 1 bit mutex tests asserts: ((gsize) ptrs) % 8, ==, 0), which fails
    when the platform only aligns porters to 32 bits (e.g. S390 and
    powerpc).
    
    I'm not sure why this assertion was placed here, but given
    that internally g_pointer_bit_trylock uses g_atomic_int_or internally
    change the assertion so it only requires the alignment to be a multiple
    of sizeof(int)

 gthread/tests/1bit-mutex.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gthread/tests/1bit-mutex.c b/gthread/tests/1bit-mutex.c
index 0bfce91..2a0f6dd 100644
--- a/gthread/tests/1bit-mutex.c
+++ b/gthread/tests/1bit-mutex.c
@@ -62,7 +62,7 @@ acquire (int      nr,
 
   self = g_thread_self ();
 
-  g_assert_cmpint (((gsize) ptrs) % 8, ==, 0);
+  g_assert_cmpint (((gsize) ptrs) % sizeof(gint), ==, 0);
 
   if (!(use_pointers ?
           g_pointer_bit_trylock (&ptrs[nr], bits[nr])



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]