2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 20:53:53 +08:00
linux-next/arch/arm
David Howells f0d1b0b30d [PATCH] LOG2: Implement a general integer log2 facility in the kernel
This facility provides three entry points:

	ilog2()		Log base 2 of unsigned long
	ilog2_u32()	Log base 2 of u32
	ilog2_u64()	Log base 2 of u64

These facilities can either be used inside functions on dynamic data:

	int do_something(long q)
	{
		...;
		y = ilog2(x)
		...;
	}

Or can be used to statically initialise global variables with constant values:

	unsigned n = ilog2(27);

When performing static initialisation, the compiler will report "error:
initializer element is not constant" if asked to take a log of zero or of
something not reducible to a constant.  They treat negative numbers as
unsigned.

When not dealing with a constant, they fall back to using fls() which permits
them to use arch-specific log calculation instructions - such as BSR on
x86/x86_64 or SCAN on FRV - if available.

[akpm@osdl.org: MMC fix]
Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David Howells <dhowells@redhat.com>
Cc: Wojtek Kaniewski <wojtekka@toxygen.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-08 08:28:51 -08:00
..
boot fix file specification in comments 2006-10-03 23:01:26 +02:00
common Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-12-07 15:40:39 -08:00
configs [ARM] Merge individual ARM sub-trees 2006-12-07 23:07:26 +00:00
kernel Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-12-07 15:40:39 -08:00
lib Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
mach-aaec2000 [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-at91rm9200 [ARM] Merge individual ARM sub-trees 2006-12-07 23:07:26 +00:00
mach-clps711x [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-clps7500 [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-ebsa110 [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-ep93xx [ARM] Merge individual ARM sub-trees 2006-12-07 23:07:26 +00:00
mach-footbridge [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-h720x [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-imx [ARM] 3991/1: i.MX/MX1 high resolution time source 2006-12-07 16:24:16 +00:00
mach-integrator [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-iop13xx [ARM] 3995/1: iop13xx: add iop13xx support 2006-12-07 17:20:21 +00:00
mach-iop32x [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-iop33x [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-ixp4xx Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-12-07 15:40:39 -08:00
mach-ixp23xx [ARM] 3994/1: ixp23xx: fix handling of pci master aborts 2006-12-07 16:16:19 +00:00
mach-ixp2000 [ARM] 3965/1: ixp2000: fix handling of pci master aborts 2006-12-01 16:55:22 +00:00
mach-l7200 [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-lh7a40x Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-12-07 15:40:39 -08:00
mach-netx [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-omap1 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-12-07 15:40:39 -08:00
mach-omap2 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-12-07 15:40:39 -08:00
mach-pnx4008 [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-pxa Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-12-07 15:40:39 -08:00
mach-realview Initial blind fixup for arm for irq changes 2006-10-06 10:59:54 -07:00
mach-rpc [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-s3c2410 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-12-07 15:40:39 -08:00
mach-sa1100 [ARM] Merge individual ARM sub-trees 2006-12-07 23:07:26 +00:00
mach-shark [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
mach-versatile [ARM] Merge individual ARM sub-trees 2006-12-07 23:07:26 +00:00
mm Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2006-12-07 15:40:39 -08:00
nwfpe [ARM] 3729/3: EABI padding rules necessitate the packed attribute of floatx80 2006-07-13 13:04:24 +01:00
oprofile [ARM] Remove OP_MAX_COUNTER 2006-11-14 15:15:40 +00:00
plat-iop Initial blind fixup for arm for irq changes 2006-10-06 10:59:54 -07:00
plat-omap [ARM] Remove compatibility layer for ARM irqs 2006-11-30 12:24:47 +00:00
tools [ARM] Update mach-types 2006-12-07 17:19:58 +00:00
vfp [ARM] 3900/1: Fix VFP Division by Zero exception handling. 2006-10-28 10:15:31 +01:00
Kconfig [PATCH] LOG2: Implement a general integer log2 facility in the kernel 2006-12-08 08:28:51 -08:00
Kconfig-nommu [ARM] nommu: manage the CP15 things 2006-09-27 17:34:30 +01:00
Kconfig.debug [ARM] Remove DEBUG_WAITQ 2006-11-30 12:24:47 +00:00
Makefile [ARM] Merge individual ARM sub-trees 2006-12-07 23:07:26 +00:00