BITS_PER_LONG

Martin Mares (mj@mj.gts.cz)
Sun, 28 Dec 1997 13:33:14 +0100


Hi,

The following patch adds a BITS_PER_LONG macro to asm/types.h, allowing
generic code to contain conditionally compiled parts for 32/64-bit
architectures. Also kills local BITS_PER_LONG from keyboard.c.

Have a nice fortnight

-- 
Martin `MJ' Mares   <mj@gts.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"WINDOWS - What Idiotic New Disk Operating Windowing System!"

--- /usr/src/linux-2.1/include/asm-alpha/types.h Tue Mar 26 15:47:39 1996 +++ include/asm-alpha/types.h Mon Dec 22 21:47:59 1997 @@ -63,11 +63,13 @@ typedef signed long long s64; typedef unsigned long long u64; +#define BITS_PER_LONG 32 #else typedef signed long s64; typedef unsigned long u64; +#define BITS_PER_LONG 64 #endif --- /usr/src/linux-2.1/include/asm-i386/types.h Tue Mar 26 15:47:23 1996 +++ include/asm-i386/types.h Mon Dec 22 21:48:03 1997 @@ -39,6 +39,8 @@ typedef signed long long s64; typedef unsigned long long u64; +#define BITS_PER_LONG 32 + #endif /* __KERNEL__ */ #endif --- /usr/src/linux-2.1/include/asm-m68k/types.h Fri Apr 5 13:08:41 1996 +++ include/asm-m68k/types.h Mon Dec 22 21:48:06 1997 @@ -47,6 +47,8 @@ typedef signed long long s64; typedef unsigned long long u64; +#define BITS_PER_LONG 32 + #endif /* __KERNEL__ */ #endif /* _M68K_TYPES_H */ --- /usr/src/linux-2.1/include/asm-mips/types.h Thu Jul 17 14:09:58 1997 +++ include/asm-mips/types.h Mon Dec 22 21:48:10 1997 @@ -60,11 +60,13 @@ typedef __signed__ long long s64; typedef unsigned long long u64; #endif +#define BITS_PER_LONG 32 #else typedef __signed__ long s64; typedef unsigned long u64; +#define BITS_PER_LONG 64 #endif --- /usr/src/linux-2.1/include/asm-ppc/types.h Mon May 27 11:00:59 1996 +++ include/asm-ppc/types.h Mon Dec 22 21:48:13 1997 @@ -39,6 +39,8 @@ typedef signed long long s64; typedef unsigned long long u64; +#define BITS_PER_LONG 32 + #endif /* __KERNEL__ */ #endif --- /usr/src/linux-2.1/include/asm-sparc/types.h Sun Apr 13 15:19:54 1997 +++ include/asm-sparc/types.h Mon Dec 22 21:48:29 1997 @@ -1,4 +1,4 @@ -/* $Id: types.h,v 1.10 1996/08/29 09:49:04 davem Exp $ */ +/* $Id: types.h,v 1.11 1997/12/22 13:28:22 mj Exp $ */ #ifndef _SPARC_TYPES_H #define _SPARC_TYPES_H @@ -42,6 +42,8 @@ typedef __signed__ long long s64; typedef unsigned long long u64; + +#define BITS_PER_LONG 32 #endif /* __KERNEL__ */ --- /usr/src/linux-2.1/include/asm-sparc64/types.h Sun Apr 13 15:21:38 1997 +++ include/asm-sparc64/types.h Mon Dec 22 21:48:46 1997 @@ -1,4 +1,4 @@ -/* $Id: types.h,v 1.1 1996/11/20 12:03:51 davem Exp $ */ +/* $Id: types.h,v 1.2 1997/12/22 13:28:33 mj Exp $ */ #ifndef _SPARC64_TYPES_H #define _SPARC64_TYPES_H @@ -42,6 +42,8 @@ typedef __signed__ long s64; typedef unsigned long u64; + +#define BITS_PER_LONG 64 #endif /* __KERNEL__ */ --- /usr/src/linux-2.1/drivers/char/keyboard.c Sat Dec 13 21:17:59 1997 +++ drivers/char/keyboard.c Thu Dec 25 21:55:19 1997 @@ -80,7 +80,6 @@ /* shift state counters.. */ static unsigned char k_down[NR_SHIFT] = {0, }; /* keyboard key bitmap */ -#define BITS_PER_LONG (8*sizeof(unsigned long)) static unsigned long key_down[256/BITS_PER_LONG] = { 0, }; static int dead_key_next = 0;