Re: [PATCH] Introduce a boolean "single_bit_set" function.
From: Petr Tesarik
Date: Thu May 28 2009 - 08:21:24 EST
Robert P. J. Day pÃÅe v Ät 23. 04. 2009 v 13:43 -0400:
> A boolean single_bit_set() routine would simplify the numerous
> constructs of the form (((n & (n - 1)) == 0)) when testing for
> Signed-off-by: Robert P. J. Day <rpjday@xxxxxxxxxxxxxx>
> This is similar to the current is_power_of_2() routine defined in
> include/linux/log2.h, which is mathematically identical but,
> semantically, should be defined independently just so the code is more
> I'm open to an alternative function name.
Because what it really does is to check that a value is a power of two,
P.S. aka I want my bikeshed mathematical!
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/