[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aday6kbt14a.fsf@roland-alpha.cisco.com>
Date: Wed, 06 Jan 2010 12:44:05 -0800
From: Roland Dreier <rdreier@...co.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org,
Bart Van Assche <bart.vanassche@...il.com>,
David Dillow <dave@...dillows.org>
Subject: Re: [PATCH] log2.h: Macro-ize is_power_of_2() for use in BUILD_BUG_ON
> Perhaps we can avoid worrying about that via
> #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
> BUILD_BUG_ON((n != 0 && ((n & (n - 1)) == 0)))
Having something so specific to this particular case makes me feel like
maybe it's just not worth it. At least in the case I'm looking at, we
could just have:
/*
* The code relies on FOO being a power of 2. If you break this,
* you're dumb.
*/
#define FOO_SHIFT 6
#define FOO (1 << FOO_SHIFT)
Your thoughts?
- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists