summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/bitmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/sys/bitmap.h')
-rw-r--r--usr/src/uts/common/sys/bitmap.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr/src/uts/common/sys/bitmap.h b/usr/src/uts/common/sys/bitmap.h
index 8476ba9563..d0dd12b683 100644
--- a/usr/src/uts/common/sys/bitmap.h
+++ b/usr/src/uts/common/sys/bitmap.h
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -124,6 +124,14 @@ extern "C" {
#endif /* _LP64 */
+/*
+ * BIT_ONLYONESET is a private macro not designed for bitmaps of
+ * arbitrary size. u must be an unsigned integer/long. It returns
+ * true if one and only one bit is set in u.
+ */
+#define BIT_ONLYONESET(u) \
+ ((((u) == 0) ? 0 : ((u) & ((u) - 1)) == 0))
+
#if defined(_KERNEL) && !defined(_ASM)
#include <sys/atomic.h>