summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2009-11-04 11:40:55 -0800
committerIan Romanick <ian.d.romanick@intel.com>2009-11-04 11:40:55 -0800
commitfe619d976ba03d756b0f7a6b0410437d20a4c211 (patch)
treeff9475718a4be2ff0924ca135154cd81f8c4a03d
parenta468b3af69eeeb5b8463ee6f49a82bffbee11a1b (diff)
Add macros for working with GLbitfield64
-rw-r--r--src/mesa/main/mtypes.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 1d8cf8336f..30aa3df3fb 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -79,10 +79,29 @@
/**
- * 64-bit extension of GLbitfield.
+ * \name 64-bit extension of GLbitfield.
*/
+/*@{*/
typedef GLuint64 GLbitfield64;
+#define BITFIELD64_ONE 1ULL
+#define BITFIELD64_ALLONES ~0ULL
+
+/** Set a single bit */
+#define BITFIELD64_BIT(b) (BITFIELD64_ONE << (b))
+
+/** Set a mask of the least significant \c b bits */
+#define BITFIELD64_MASK(b) (((b) >= 64) ? BITFIELD64_ALLONES : \
+ (BITFIELD64_BIT(b) - 1))
+
+/**
+ * Set all bits from l (low bit) to h (high bit), inclusive.
+ *
+ * \note \C BITFIELD_64_RANGE(0, 63) return 64 set bits.
+ */
+#define BITFIELD64_RANGE(l, h) (BITFIELD64_MASK((h) + 1) & ~BITFIELD64_MASK(l))
+/*@}*/
+
/**
* \name Some forward type declarations