android_kernel_xiaomi_sm8350/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
fpsp040
hp300 IRQ: Use the new typedef for interrupt handler function pointers 2006-10-09 12:19:47 +01:00
ifpsp060
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
defconfig
Kconfig [PATCH] LOG2: Implement a general integer log2 facility in the kernel 2006-12-08 08:28:51 -08:00
Kconfig.debug
Makefile