about summary refs log tree commit diff
path: root/sysdeps/x86_64
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-11-26 16:42:38 -0800
committerH.J. Lu <hjl.tools@gmail.com>2012-11-26 16:45:36 -0800
commitc515fb5148f1d81d5f7736825e14c7502c15432a (patch)
treebffe0f355bac8c00df91b12a1feddc768677bc5d /sysdeps/x86_64
parent4cf77aa9847aac13bf65c977396b6e8a66337238 (diff)
downloadglibc-c515fb5148f1d81d5f7736825e14c7502c15432a.tar.gz
glibc-c515fb5148f1d81d5f7736825e14c7502c15432a.tar.xz
glibc-c515fb5148f1d81d5f7736825e14c7502c15432a.zip
Cast to __intptr_t before casting pointer to int64
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r--sysdeps/x86_64/bits/atomic.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/sysdeps/x86_64/bits/atomic.h b/sysdeps/x86_64/bits/atomic.h
index 100943fa1e..552581c46e 100644
--- a/sysdeps/x86_64/bits/atomic.h
+++ b/sysdeps/x86_64/bits/atomic.h
@@ -18,6 +18,7 @@
 
 #include <stdint.h>
 #include <tls.h>	/* For tcbhead_t.  */
+#include <libc-internal.h>
 
 
 typedef int8_t atomic8_t;
@@ -101,8 +102,9 @@ typedef uintmax_t uatomic_max_t;
 		       "lock\n"						      \
 		       "0:\tcmpxchgq %q2, %1"				      \
 		       : "=a" (ret), "=m" (*mem)			      \
-		       : "q" ((atomic64_t) (newval)), "m" (*mem),	      \
-			 "0" ((atomic64_t) (oldval)),		      \
+		       : "q" ((atomic64_t) cast_to_integer (newval)),	      \
+			 "m" (*mem),					      \
+			 "0" ((atomic64_t) cast_to_integer (oldval)),	      \
 			 "i" (offsetof (tcbhead_t, multiple_threads)));	      \
      ret; })
 
@@ -125,7 +127,8 @@ typedef uintmax_t uatomic_max_t;
      else								      \
        __asm __volatile ("xchgq %q0, %1"				      \
 			 : "=r" (result), "=m" (*mem)			      \
-			 : "0" ((atomic64_t) (newvalue)), "m" (*mem));	      \
+			 : "0" ((atomic64_t) cast_to_integer (newvalue)),     \
+			   "m" (*mem));					      \
      result; })
 
 
@@ -149,7 +152,8 @@ typedef uintmax_t uatomic_max_t;
      else								      \
        __asm __volatile (lock "xaddq %q0, %1"				      \
 			 : "=r" (result), "=m" (*mem)			      \
-			 : "0" ((atomic64_t) (value)), "m" (*mem),	      \
+			 : "0" ((atomic64_t) cast_to_integer (value)),	      \
+			   "m" (*mem),					      \
 			   "i" (offsetof (tcbhead_t, multiple_threads)));     \
      result; })
 
@@ -187,7 +191,8 @@ typedef uintmax_t uatomic_max_t;
     else								      \
       __asm __volatile (lock "addq %q1, %0"				      \
 			: "=m" (*mem)					      \
-			: "ir" ((atomic64_t) (value)), "m" (*mem),	      \
+			: "ir" ((atomic64_t) cast_to_integer (value)),	      \
+			  "m" (*mem),					      \
 			  "i" (offsetof (tcbhead_t, multiple_threads)));      \
   } while (0)
 
@@ -218,7 +223,8 @@ typedef uintmax_t uatomic_max_t;
      else								      \
        __asm __volatile (LOCK_PREFIX "addq %q2, %0; sets %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
-			 : "ir" ((atomic64_t) (value)), "m" (*mem));	      \
+			 : "ir" ((atomic64_t) cast_to_integer (value)),	      \
+			   "m" (*mem));					      \
      __result; })
 
 
@@ -239,7 +245,8 @@ typedef uintmax_t uatomic_max_t;
      else								      \
        __asm __volatile (LOCK_PREFIX "addq %q2, %0; setz %1"		      \
 			 : "=m" (*mem), "=qm" (__result)		      \
-			 : "ir" ((atomic64_t) (value)), "m" (*mem));	      \
+			 : "ir" ((atomic64_t) cast_to_integer (value)),	      \
+			   "m" (*mem));					      \
      __result; })