diff options
author | Timothy Arceri <[email protected]> | 2019-02-06 12:18:52 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2019-02-08 02:54:56 +0000 |
commit | d0abbaa528a0b23999079951c88effb3f2c0d27a (patch) | |
tree | acdb34afda6c33e789a68649a534f0107349b2ed /src | |
parent | cbd1ad6165f0aea7fb7c6fd1b36ad5317dd65cb7 (diff) |
util: move BITFIELD macros to util/macros.h
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/menums.h | 24 | ||||
-rw-r--r-- | src/util/macros.h | 18 |
2 files changed, 18 insertions, 24 deletions
diff --git a/src/mesa/main/menums.h b/src/mesa/main/menums.h index 40b16cb9cac..79c14da5ea0 100644 --- a/src/mesa/main/menums.h +++ b/src/mesa/main/menums.h @@ -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 diff --git a/src/util/macros.h b/src/util/macros.h index c47bbb6dfcd..73d4e68b99a 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -296,4 +296,22 @@ do { \ #define EXPLICIT_CONVERSION #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 */ |