Skip to content

Commit e81fcd4

Browse files
Peter Zijlstraacmel
authored andcommitted
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>
1 parent 32a951b commit e81fcd4

1 file changed

Lines changed: 2 additions & 21 deletions

File tree

‎tools/include/asm-generic/bitsperlong.h‎

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,12 @@
33

44
#include <uapi/asm-generic/bitsperlong.h>
55

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-
*/
116
#ifdef __SIZEOF_LONG__
12-
# if __SIZEOF_LONG__ == 8
13-
# define CONFIG_64BIT
14-
# endif
7+
#define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
158
#else
16-
# ifdef __WORDSIZE
17-
# if __WORDSIZE == 64
18-
# define CONFIG_64BIT
19-
# endif
20-
# else
21-
# error Failed to determine BITS_PER_LONG value
22-
# endif
9+
#define BITS_PER_LONG __WORDSIZE
2310
#endif
2411

25-
#ifdef CONFIG_64BIT
26-
#define BITS_PER_LONG 64
27-
#else
28-
#define BITS_PER_LONG 32
29-
#endif /* CONFIG_64BIT */
30-
3112
#if BITS_PER_LONG != __BITS_PER_LONG
3213
#error Inconsistent word size. Check asm/bitsperlong.h
3314
#endif

0 commit comments

Comments
 (0)