Mesa (outputswritten64): Add macros for working with GLbitfield64

Ian Romanick idr at kemper.freedesktop.org
Fri Nov 6 18:43:58 UTC 2009


Module: Mesa
Branch: outputswritten64
Commit: fe619d976ba03d756b0f7a6b0410437d20a4c211
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fe619d976ba03d756b0f7a6b0410437d20a4c211

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Nov  4 11:40:55 2009 -0800

Add macros for working with GLbitfield64

---

 src/mesa/main/mtypes.h |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 1d8cf83..30aa3df 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




More information about the mesa-commit mailing list