[POWERPC] Add "is_power_of_2" checking to log2.h.

Add the inline function "is_power_of_2()" to log2.h, where the value
zero is *not* considered to be a power of two.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
Robert P. J. Day
2007-01-30 06:06:00 -05:00
committed by Paul Mackerras
父節點 7df2457db8
當前提交 63c2f782e8
共有 5 個文件被更改,包括 13 次插入12 次删除

查看文件

@@ -294,11 +294,8 @@ void __init mapin_ram(void)
}
}
/* is x a power of 2? */
#define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))
/* is x a power of 4? */
#define is_power_of_4(x) ((x) != 0 && (((x) & (x-1)) == 0) && (ffs(x) & 1))
#define is_power_of_4(x) is_power_of_2(x) && (ffs(x) & 1))
/*
* Set up a mapping for a block of I/O.