aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2016-07-15 11:38:18 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-07-15 16:26:41 -0400
commite81fcd43723d32e9c9dbb8e8d66f147b5b84256b (patch)
treec370d3758d360c49b8262495c3da4a15018ab1e7
parent32a951b4fd6bbe60ef5d65930b1712321e241b27 (diff)
tools: Simplify BITS_PER_LONG define
Do it using (__CHAR_BIT__ * __SIZEOF_LONG__), simpler, works everywhere, reduces the complexity by ditching CONFIG_64BIT, that was being synthesized from yet another set of defines, which proved fragile, breaking the build on linux-next for no obvious reasons. Committer Note: Except on: gcc version 4.1.2 20080704 (Red Hat 4.1.2-55) Fallback to __WORDSIZE in that case... Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20160715072243.GP30154@twins.programming.kicks-ass.net Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/include/asm-generic/bitsperlong.h23
1 files changed, 2 insertions, 21 deletions
diff --git a/tools/include/asm-generic/bitsperlong.h b/tools/include/asm-generic/bitsperlong.h
index cfd661c6fc17..45eca517efb3 100644
--- a/tools/include/asm-generic/bitsperlong.h
+++ b/tools/include/asm-generic/bitsperlong.h
@@ -3,31 +3,12 @@
3 3
4#include <uapi/asm-generic/bitsperlong.h> 4#include <uapi/asm-generic/bitsperlong.h>
5 5
6/*
7 * In the kernel, where this file comes from, we can rely on CONFIG_64BIT,
8 * here we have to make amends with what the various compilers provides us
9 * to figure out if we're on a 64-bit machine...
10 */
11#ifdef __SIZEOF_LONG__ 6#ifdef __SIZEOF_LONG__
12# if __SIZEOF_LONG__ == 8 7#define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
13# define CONFIG_64BIT
14# endif
15#else 8#else
16# ifdef __WORDSIZE 9#define BITS_PER_LONG __WORDSIZE
17# if __WORDSIZE == 64
18# define CONFIG_64BIT
19# endif
20# else
21# error Failed to determine BITS_PER_LONG value
22# endif
23#endif 10#endif
24 11
25#ifdef CONFIG_64BIT
26#define BITS_PER_LONG 64
27#else
28#define BITS_PER_LONG 32
29#endif /* CONFIG_64BIT */
30
31#if BITS_PER_LONG != __BITS_PER_LONG 12#if BITS_PER_LONG != __BITS_PER_LONG
32#error Inconsistent word size. Check asm/bitsperlong.h 13#error Inconsistent word size. Check asm/bitsperlong.h
33#endif 14#endif