X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=glib%2Fgbitlock.c;h=572c2d1873d81fb01ccddca19c866cd29977b7cf;hb=30ed5f53e205e6bfc35126a9d3c62dac8a9c5dad;hp=7674f9a3117ef340ae90dde7c7b8ee31958a9b67;hpb=4527e7cbf75f5f06a3f8b3ee9c5ecb16f6a27406;p=platform%2Fupstream%2Fglib.git
diff --git a/glib/gbitlock.c b/glib/gbitlock.c
index 7674f9a..572c2d1 100644
--- a/glib/gbitlock.c
+++ b/glib/gbitlock.c
@@ -13,13 +13,13 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see .
*
* Author: Ryan Lortie
*/
+#include "config.h"
+
#include "gbitlock.h"
#include
@@ -29,10 +29,9 @@
#include
#include "gthreadprivate.h"
-#include "config.h"
-#undef HAVE_FUTEX
#ifdef G_BIT_LOCK_FORCE_FUTEX_EMULATION
+#undef HAVE_FUTEX
#endif
#ifndef HAVE_FUTEX
@@ -207,12 +206,12 @@ g_bit_lock (volatile gint *address,
{
#ifdef USE_ASM_GOTO
retry:
- asm volatile goto ("lock bts %1, (%0)\n"
- "jc %l[contended]"
- : /* no output */
- : "r" (address), "r" (lock_bit)
- : "cc", "memory"
- : contended);
+ __asm__ volatile goto ("lock bts %1, (%0)\n"
+ "jc %l[contended]"
+ : /* no output */
+ : "r" (address), "r" (lock_bit)
+ : "cc", "memory"
+ : contended);
return;
contended:
@@ -280,12 +279,12 @@ g_bit_trylock (volatile gint *address,
#ifdef USE_ASM_GOTO
gboolean result;
- asm volatile ("lock bts %2, (%1)\n"
- "setnc %%al\n"
- "movzx %%al, %0"
- : "=r" (result)
- : "r" (address), "r" (lock_bit)
- : "cc", "memory");
+ __asm__ volatile ("lock bts %2, (%1)\n"
+ "setnc %%al\n"
+ "movzx %%al, %0"
+ : "=r" (result)
+ : "r" (address), "r" (lock_bit)
+ : "cc", "memory");
return result;
#else
@@ -366,6 +365,12 @@ g_futex_int_address (const volatile void *address)
{
const volatile gint *int_address = address;
+ /* this implementation makes these (reasonable) assumptions: */
+ G_STATIC_ASSERT (G_BYTE_ORDER == G_LITTLE_ENDIAN ||
+ (G_BYTE_ORDER == G_BIG_ENDIAN &&
+ sizeof (int) == 4 &&
+ (sizeof (gpointer) == 4 || sizeof (gpointer) == 8)));
+
#if G_BYTE_ORDER == G_BIG_ENDIAN && GLIB_SIZEOF_VOID_P == 8
int_address++;
#endif