aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorRoland Dreier <rdreier@cisco.com>2010-01-15 17:01:22 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2010-01-16 12:15:39 -0800
commitcc8ef6eb21e964b1c5eb97b2d0e8ac9893e1bf86 (patch)
treec30758f4f980a71acd662f55006af80c8a11b27f /mm
parentd2dbe08ddceb4ba2b274abb84326d7e69d454e5c (diff)
downloadkernel_goldelico_gta04-cc8ef6eb21e964b1c5eb97b2d0e8ac9893e1bf86.zip
kernel_goldelico_gta04-cc8ef6eb21e964b1c5eb97b2d0e8ac9893e1bf86.tar.gz
kernel_goldelico_gta04-cc8ef6eb21e964b1c5eb97b2d0e8ac9893e1bf86.tar.bz2
kernel.h: add BUILD_BUG_ON_NOT_POWER_OF_2()
Add BUILD_BUG_ON_NOT_POWER_OF_2() When code relies on a constant being a power of 2: #define FOO 512 /* must be a power of 2 */ it would be nice to be able to do: BUILD_BUG_ON(!is_power_of_2(FOO)); However applying an inline function does not result in a compile-time constant that can be used with BUILD_BUG_ON(), so trying that gives results in: error: bit-field '<anonymous>' width not an integer constant As suggested by akpm, rather than monkeying around with is_power_of_2() and risking gcc warts about constant expressions, just create a macro BUILD_BUG_ON_NOT_POWER_OF_2() to encapsulate this common requirement. Signed-off-by: Roland Dreier <rolandd@cisco.com> Cc: Bart Van Assche <bvanassche@acm.org> Cc: David Dillow <dave@thedillows.org> Cc: "Robert P. J. Day" <rpjday@crashcourse.ca> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
0 files changed, 0 insertions, 0 deletions