lkml.org 
[lkml]   [2007]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Add the macro to test if "exactly_one_bit_set" to log2.h.

While this macro is defined in terms of "is_power_of_2" and is
therefore functionally equivalent, the visual semantics are sometimes
more appropriate for what is actually being tested.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>

---

diff --git a/include/linux/log2.h b/include/linux/log2.h
index c8cf5e8..d0d324e 100644
--- a/include/linux/log2.h
+++ b/include/linux/log2.h
@@ -55,6 +55,12 @@ bool is_power_of_2(unsigned long n)
}

/*
+ * And for folks who want slightly different semantics ...
+ */
+
+#define exactly_one_bit_set is_power_of_2
+
+/*
* round up to nearest power of two
*/
static inline __attribute__((const))
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA
http://crashcourse.ca
========================================================================
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2007-11-06 17:43    [W:0.051 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site