centralize definition of BITS_PER_LONG
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 1 Mar 2010 19:12:21 +0000 (14:12 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 1 Mar 2010 19:12:21 +0000 (14:12 -0500)
Use __SIZEOF_LONG__, defined by GCC 4.3 or later, or _LP64, defined
by GCC 3.4 or later.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu/arch_ppc.h
urcu/arch_s390.h
urcu/arch_sparc64.h
urcu/compiler.h
urcu/uatomic_arch_ppc.h
urcu/uatomic_arch_s390.h
urcu/uatomic_arch_sparc64.h
urcu/uatomic_arch_x86.h
urcu/uatomic_generic.h

index 1e096dbb893eca6e0cca03aba5858c7cee44f5c6..eeeb753936d6c0f036305905829513aecc11843b 100644 (file)
@@ -32,10 +32,6 @@ extern "C" {
 /* Include size of POWER5+ L3 cache lines: 256 bytes */
 #define CACHE_LINE_SIZE        256
 
-#ifndef BITS_PER_LONG
-#define BITS_PER_LONG  (__SIZEOF_LONG__ * 8)
-#endif
-
 #define mb()    asm volatile("sync":::"memory")
 
 /*
index 4ad3ee8edd39e8c9f7752ebc0d82db4e90722280..1a55e0d4e4c4596ccca31a184c2d0e668320d574 100644 (file)
@@ -37,18 +37,6 @@ extern "C" {
 
 #define CACHE_LINE_SIZE        128
 
-#ifndef __SIZEOF_LONG__
-#ifdef __s390x__
-#define __SIZEOF_LONG__ 8
-#else
-#define __SIZEOF_LONG__ 4
-#endif
-#endif
-
-#ifndef BITS_PER_LONG
-#define BITS_PER_LONG  (__SIZEOF_LONG__ * 8)
-#endif
-
 #define mb()    __asm__ __volatile__("bcr 15,0" : : : "memory")
 
 typedef unsigned long long cycles_t;
index 4d08d555a31fe4fb1cbfe99d17b57924ce9a2f95..9d85b5e023c6a5bc74eba6e05fa3bb7c6090f46b 100644 (file)
@@ -31,10 +31,6 @@ extern "C" {
 
 #define CACHE_LINE_SIZE        256
 
-#ifndef BITS_PER_LONG
-#define BITS_PER_LONG  (__SIZEOF_LONG__ * 8)
-#endif
-
 /*
  * Inspired from the Linux kernel. Workaround Spitfire bug #51.
  */
index aab2c5cdd7bff1c590896f0add675ba3435fcc3a..5b7bb305b2de83b1828171f506d7241d3c692d03 100644 (file)
 #define min(a,b) ((a)<(b)?(a):(b))
 #endif
 
+#if defined(__SIZEOF_LONG__)
+#define BITS_PER_LONG  (__SIZEOF_LONG__ * 8)
+#elif defined(_LP64)
+#define BITS_PER_LONG  64
+#else
+#define BITS_PER_LONG  32
+#endif
+
 #endif /* _URCU_COMPILER_H */
index 39c4c2400113555519d8b3ce37d6db5cae710e4a..4db7007ff991de54088aa39913eeac431c65648a 100644 (file)
 extern "C" {
 #endif 
 
-#ifndef __SIZEOF_LONG__
-#ifdef __powerpc64__
-#define __SIZEOF_LONG__ 8
-#else
-#define __SIZEOF_LONG__ 4
-#endif
-#endif
-
 #ifdef __NO_LWSYNC__
 #define LWSYNC_OPCODE  "sync\n"
 #else
 #define LWSYNC_OPCODE  "lwsync\n"
 #endif
 
-#ifndef BITS_PER_LONG
-#define BITS_PER_LONG  (__SIZEOF_LONG__ * 8)
-#endif
-
 #define ILLEGAL_INSTR  ".long  0xd00d00"
 
 /*
index 5942ffe46bf81220383ab36757dc1628274915e0..0a0f2381835542e16216421657de8b755f2b0e42 100644 (file)
 extern "C" {
 #endif 
 
-#ifndef __SIZEOF_LONG__
-#ifdef __s390x__
-#define __SIZEOF_LONG__ 8
-#else
-#define __SIZEOF_LONG__ 4
-#endif
-#endif
-
-#ifndef BITS_PER_LONG
-#define BITS_PER_LONG  (__SIZEOF_LONG__ * 8)
-#endif
-
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
 #define COMPILER_HAVE_SHORT_MEM_OPERAND
 #endif
index 81f95cbe91ac641aacdce2e5e2f450a9cf1ec41f..399ac120a5a64e37874845801e9d645bd4d26638 100644 (file)
 extern "C" {
 #endif 
 
-#ifndef __SIZEOF_LONG__
-#ifdef __LP64__
-#define __SIZEOF_LONG__ 8
-#else
-#define __SIZEOF_LONG__ 4
-#endif
-#endif
-
-#ifndef BITS_PER_LONG
-#define BITS_PER_LONG  (__SIZEOF_LONG__ * 8)
-#endif
-
 /* cmpxchg */
 
 static inline __attribute__((always_inline))
index 666e498f326c4c3b8ce025352b3f385416dbc32b..043e616d5e0e94abac9689959c0b2416c8ee4a61 100644 (file)
 extern "C" {
 #endif 
 
-#ifndef __SIZEOF_LONG__
-#if defined(__x86_64__) || defined(__amd64__)
-#define __SIZEOF_LONG__ 8
-#else
-#define __SIZEOF_LONG__ 4
-#endif
-#endif
-
-#ifndef BITS_PER_LONG
-#define BITS_PER_LONG  (__SIZEOF_LONG__ * 8)
-#endif
-
 /*
  * Derived from AO_compare_and_swap() and AO_test_and_set_full().
  */
index 9ee7b7bdc22a6bedeef45ef6447d930162375c99..93435d1434a4d83cffad14b3605189c3b3563756 100644 (file)
 extern "C" {
 #endif
 
-#ifndef BITS_PER_LONG
-#define BITS_PER_LONG  (__SIZEOF_LONG__ * 8)
-#endif
-
 #ifndef uatomic_set
 #define uatomic_set(addr, v)   STORE_SHARED(*(addr), (v))
 #endif
This page took 0.028852 seconds and 4 git commands to generate.