Re: [PATCH] Add BUILD_BUG_ON_NOT_POWER_OF_2()

From: Bart Van Assche
Date: Thu Jan 07 2010 - 02:33:28 EST


On Thu, Jan 7, 2010 at 12:02 AM, Roland Dreier <rdreier@xxxxxxxxx> wrote:
> +/* Force a compilation error if expression is not a power of 2 */
> +#define BUILD_BUG_ON_NOT_POWER_OF_2(n)                 \
> +       BUILD_BUG_ON(((n) != 0 && (((n) & ((n) - 1)) == 0)))

Hello Roland,

Can you please change the above into the following, such that the
macro does what its name suggests:

#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
BUILD_BUG_ON(((n) == 0 || (((n) & ((n) - 1)) != 0)))

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/