util: move BITFIELD macros to util/macros.h
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
@@ -186,28 +186,4 @@ enum mesa_debug_severity
|
|||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/** Set a single bit */
|
|
||||||
#define BITFIELD_BIT(b) (1u << (b))
|
|
||||||
/** Set all bits up to excluding bit b */
|
|
||||||
#define BITFIELD_MASK(b) \
|
|
||||||
((b) == 32 ? (~0u) : BITFIELD_BIT((b) % 32) - 1)
|
|
||||||
/** Set count bits starting from bit b */
|
|
||||||
#define BITFIELD_RANGE(b, count) \
|
|
||||||
(BITFIELD_MASK((b) + (count)) & ~BITFIELD_MASK(b))
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \name 64-bit extension of GLbitfield.
|
|
||||||
*/
|
|
||||||
/*@{*/
|
|
||||||
|
|
||||||
/** Set a single bit */
|
|
||||||
#define BITFIELD64_BIT(b) (1ull << (b))
|
|
||||||
/** Set all bits up to excluding bit b */
|
|
||||||
#define BITFIELD64_MASK(b) \
|
|
||||||
((b) == 64 ? (~0ull) : BITFIELD64_BIT(b) - 1)
|
|
||||||
/** Set count bits starting from bit b */
|
|
||||||
#define BITFIELD64_RANGE(b, count) \
|
|
||||||
(BITFIELD64_MASK((b) + (count)) & ~BITFIELD64_MASK(b))
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -296,4 +296,22 @@ do { \
|
|||||||
#define EXPLICIT_CONVERSION
|
#define EXPLICIT_CONVERSION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** Set a single bit */
|
||||||
|
#define BITFIELD_BIT(b) (1u << (b))
|
||||||
|
/** Set all bits up to excluding bit b */
|
||||||
|
#define BITFIELD_MASK(b) \
|
||||||
|
((b) == 32 ? (~0u) : BITFIELD_BIT((b) % 32) - 1)
|
||||||
|
/** Set count bits starting from bit b */
|
||||||
|
#define BITFIELD_RANGE(b, count) \
|
||||||
|
(BITFIELD_MASK((b) + (count)) & ~BITFIELD_MASK(b))
|
||||||
|
|
||||||
|
/** Set a single bit */
|
||||||
|
#define BITFIELD64_BIT(b) (1ull << (b))
|
||||||
|
/** Set all bits up to excluding bit b */
|
||||||
|
#define BITFIELD64_MASK(b) \
|
||||||
|
((b) == 64 ? (~0ull) : BITFIELD64_BIT(b) - 1)
|
||||||
|
/** Set count bits starting from bit b */
|
||||||
|
#define BITFIELD64_RANGE(b, count) \
|
||||||
|
(BITFIELD64_MASK((b) + (count)) & ~BITFIELD64_MASK(b))
|
||||||
|
|
||||||
#endif /* UTIL_MACROS_H */
|
#endif /* UTIL_MACROS_H */
|
||||||
|
Reference in New Issue
Block a user