2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-22 12:14:01 +08:00
linux-next/arch/m68k
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
..
amiga [PATCH] m68k: replace kmalloc+memset with kzalloc 2006-12-07 08:39:29 -08:00
apollo [PATCH] m68k/Apollo: Remove obsolete arch/m68k/apollo/dma.c 2006-10-09 14:54:46 -07:00
atari [PATCH] m68k: replace kmalloc+memset with kzalloc 2006-12-07 08:39:29 -08:00
bvme6000 IRQ: Use the new typedef for interrupt handler function pointers 2006-10-09 12:19:47 +01:00
configs [PATCH] M68k: Mark Sun-3 NCR5380 SCSI broken 2005-06-12 20:43:22 -07:00
fpsp040 [PATCH] Add wording to m68k .S files to help clarify license info 2006-02-11 21:41:11 -08:00
hp300 IRQ: Use the new typedef for interrupt handler function pointers 2006-10-09 12:19:47 +01:00
ifpsp060 [PATCH] m68k: convert thread flags to use bit fields 2005-11-13 18:14:14 -08:00
kernel [PATCH] m68k: consolidate initcall sections 2006-10-29 12:07:41 -08:00
lib [NET]: M68K checksum annotations and cleanups. 2006-12-02 21:23:07 -08:00
mac IRQ: Use the new typedef for interrupt handler function pointers 2006-10-09 12:19:47 +01:00
math-emu Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
mm [PATCH] mm: arch do_page_fault() vs in_atomic() 2006-12-07 08:39:21 -08:00
mvme16x IRQ: Use the new typedef for interrupt handler function pointers 2006-10-09 12:19:47 +01:00
mvme147 IRQ: Use the new typedef for interrupt handler function pointers 2006-10-09 12:19:47 +01:00
q40 IRQ: Use the new typedef for interrupt handler function pointers 2006-10-09 12:19:47 +01:00
sun3 [PATCH] clean m68k ksyms 2006-10-11 11:17:06 -07:00
sun3x IRQ: Use the new typedef for interrupt handler function pointers 2006-10-09 12:19:47 +01:00
tools/amiga Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
defconfig [PATCH] M68k: Update defconfigs 2005-06-12 20:43:21 -07:00
Kconfig [PATCH] LOG2: Implement a general integer log2 facility in the kernel 2006-12-08 08:28:51 -08:00
Kconfig.debug Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
Makefile kbuild: m68k,parisc,ppc,ppc64,s390,xtensa use generic asm-offsets.h support 2005-09-09 20:57:26 +02:00