linux/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
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
mach-aaec2000
mach-at91rm9200 [ARM] Merge individual ARM sub-trees 2006-12-07 23:07:26 +00:00
mach-clps711x
mach-clps7500
mach-ebsa110
mach-ep93xx [ARM] Merge individual ARM sub-trees 2006-12-07 23:07:26 +00:00
mach-footbridge
mach-h720x
mach-imx [ARM] 3991/1: i.MX/MX1 high resolution time source 2006-12-07 16:24:16 +00:00
mach-integrator
mach-iop13xx [ARM] 3995/1: iop13xx: add iop13xx support 2006-12-07 17:20:21 +00:00
mach-iop32x
mach-iop33x
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
mach-l7200
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
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
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
mach-rpc
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
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
oprofile
plat-iop
plat-omap
tools [ARM] Update mach-types 2006-12-07 17:19:58 +00:00
vfp
Kconfig [PATCH] LOG2: Implement a general integer log2 facility in the kernel 2006-12-08 08:28:51 -08:00
Kconfig-nommu
Kconfig.debug
Makefile [ARM] Merge individual ARM sub-trees 2006-12-07 23:07:26 +00:00