From: pbonzini@redhat.com (Paolo Bonzini)
Subject: [ltt-dev] [PATCH 12/12] centralize definition of BITS_PER_LONG
Date: Fri, 19 Feb 2010 20:22:54 +0100 [thread overview]
Message-ID: <1266607374-1107-13-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1266607374-1107-1-git-send-email-pbonzini@redhat.com>
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 at redhat.com>
---
urcu/arch_ppc.h | 4 ----
urcu/arch_s390.h | 12 ------------
urcu/arch_sparc64.h | 4 ----
urcu/compiler.h | 8 ++++++++
urcu/uatomic_arch_ppc.h | 12 ------------
urcu/uatomic_arch_s390.h | 12 ------------
urcu/uatomic_arch_sparc64.h | 12 ------------
urcu/uatomic_arch_x86.h | 12 ------------
urcu/uatomic_generic.h | 4 ----
9 files changed, 8 insertions(+), 72 deletions(-)
diff --git a/urcu/arch_ppc.h b/urcu/arch_ppc.h
index 1e096db..eeeb753 100644
--- a/urcu/arch_ppc.h
+++ b/urcu/arch_ppc.h
@@ -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")
/*
diff --git a/urcu/arch_s390.h b/urcu/arch_s390.h
index 4ad3ee8..1a55e0d 100644
--- a/urcu/arch_s390.h
+++ b/urcu/arch_s390.h
@@ -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;
diff --git a/urcu/arch_sparc64.h b/urcu/arch_sparc64.h
index 4d08d55..9d85b5e 100644
--- a/urcu/arch_sparc64.h
+++ b/urcu/arch_sparc64.h
@@ -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.
*/
diff --git a/urcu/compiler.h b/urcu/compiler.h
index aab2c5c..5b7bb30 100644
--- a/urcu/compiler.h
+++ b/urcu/compiler.h
@@ -47,4 +47,12 @@
#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 */
diff --git a/urcu/uatomic_arch_ppc.h b/urcu/uatomic_arch_ppc.h
index 39c4c24..4db7007 100644
--- a/urcu/uatomic_arch_ppc.h
+++ b/urcu/uatomic_arch_ppc.h
@@ -27,24 +27,12 @@
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"
/*
diff --git a/urcu/uatomic_arch_s390.h b/urcu/uatomic_arch_s390.h
index 5942ffe..0a0f238 100644
--- a/urcu/uatomic_arch_s390.h
+++ b/urcu/uatomic_arch_s390.h
@@ -36,18 +36,6 @@
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
diff --git a/urcu/uatomic_arch_sparc64.h b/urcu/uatomic_arch_sparc64.h
index 81f95cb..399ac12 100644
--- a/urcu/uatomic_arch_sparc64.h
+++ b/urcu/uatomic_arch_sparc64.h
@@ -27,18 +27,6 @@
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))
diff --git a/urcu/uatomic_arch_x86.h b/urcu/uatomic_arch_x86.h
index 666e498..043e616 100644
--- a/urcu/uatomic_arch_x86.h
+++ b/urcu/uatomic_arch_x86.h
@@ -30,18 +30,6 @@
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().
*/
diff --git a/urcu/uatomic_generic.h b/urcu/uatomic_generic.h
index ea2dfbf..8ab0947 100644
--- a/urcu/uatomic_generic.h
+++ b/urcu/uatomic_generic.h
@@ -28,10 +28,6 @@
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
--
1.6.6
next prev parent reply other threads:[~2010-02-19 19:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-19 19:22 [ltt-dev] [PATCH 00/12] provide generic version of uatomic and other per-arch defs Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 01/12] use kernel style makefile output Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 02/12] use autoconf symbolic linking Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 03/12] add urcu/arch_generic.h Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 04/12] define sync_core for x86 PIC Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 05/12] remove compat_uatomic_cmpxchg #define from non-x86 Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 06/12] add uatomic_generic.h, use it for common definitions Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 07/12] use uatomic_generic.h for common fallback implementations Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 08/12] move whether atomic byte/short exists to uatomic_arch_*.h Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 09/12] add Alpha support Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 10/12] support compiling on unknown architectures Paolo Bonzini
2010-02-19 19:22 ` [ltt-dev] [PATCH 11/12] avoid multiple evaluation of STORE_SHARED argument Paolo Bonzini
2010-02-19 19:22 ` Paolo Bonzini [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-02-15 19:04 [ltt-dev] [PATCH 00/12] provide default definition of uatomic builtins Paolo Bonzini
2010-02-15 19:04 ` [ltt-dev] [PATCH 12/12] centralize definition of BITS_PER_LONG Paolo Bonzini
2010-02-18 3:25 ` Mathieu Desnoyers
2010-02-18 8:45 ` Paolo Bonzini
2010-02-18 13:46 ` Mathieu Desnoyers
2010-02-18 15:27 ` Paolo Bonzini
2010-02-18 16:09 ` Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1266607374-1107-13-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox