summaryrefslogtreecommitdiffstats
path: root/src/util/bitset.h
Commit message (Collapse)AuthorAgeFilesLines
* util/bitset: fix bitset range mask calculations.Dave Airlie2019-05-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | The MASK macro is used in the RANGE macro, and it should return the pre-bitset word mask for the (b) value. i.e. BITSET_MASK(0) should be undefined since it's meaningless. BITSET_MASK(31) should give 0x7fffffff BITSET_MASK(32) should give 0xffffffff BITSET_MASK(33) should give 0x00000001 BITSET_MASK(64) should give 0xffffffff However then BITSET_RANGE ends up broken for cases where it's (b) value is the 0,32,64 value as in that case the lower mask would be 0 not 0xffffffff. This fixes the unit tests that I've added, and my code that uses bitsets. Reviewed-by: Jason Ekstrand <[email protected]> Fixes: bb38cadb1c5f2 "More GLSL code" Reviewed-by: Kristian H. Kristensen <[email protected]>
* util/bitset: Return an actual bool from test macrosJason Ekstrand2019-05-021-2/+2
| | | | | | | | | I want to be able to do BITSET_TEST() != BITSET_TEST() and this isn't currently possible because BITSET_TEST() returns a random bit. Compare to zero to get an actual Boolean. Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* util: use *unsigned* ints for bit operationsEric Engestrom2018-10-231-1/+1
| | | | | | | | Fixes errors thrown by GCC's Undefined Behaviour sanitizer (ubsan) every time this macro is used. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* util/bitset: include util/macro.hChristian Gmeiner2018-06-151-0/+1
| | | | | | | | | | BITSET_FFS(x) macro makes use of ARRAY_SIZE(x) macro which is defined in util/macro.h. Include it directy to make usage more straightforward. Fixes: 692bd4a1ab9 ("util: replace Elements() with ARRAY_SIZE()") Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* util: Include bitscan.h directlyIan Romanick2018-03-291-1/+1
| | | | | | | | | | | | | | | Previously bitset.h would include u_math.h to get bitscan.h. u_math.h lives in src/gallium/auxiliary/util while both bitset.h and bitscan.h live in src/util. Having the one file directly include another file that lives in the same directory makes much more sense. As a side-effect, several files need to directly include standard header files that were previously indirectly included. v2: Fix build break in src/amd/common/ac_nir_to_llvm.c. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* util/bitset: Make C++ wrapper trivially constructible.Francisco Jerez2018-02-271-17/+20
| | | | | | | | | | | | | | | In order to fix a build failure on compilers not implementing unrestricted unions, which is a C++11 feature. v2: Provide signed integer comparison and assignment operators instead of BITSET_WORD ones to avoid spurious ambiguity warnings on comparisons with a signed integer literal. Fixes: ba79a90fb52e1e81fb "glsl: Switch ast_type_qualifier to a 128-bit bitset." Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105238 Tested-by: Roland Scheidegger <[email protected]> Tested-By: George Kyriazis <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* util/bitset: Add C++ wrapper for static-size bitsets.Francisco Jerez2018-02-241-0/+114
| | | | Reviewed-by: Plamena Manolova <[email protected]>
* util/bitset: Allow iterating over const bitsetsJason Ekstrand2016-03-241-1/+1
| | | | Reviewed-by: Jordan Justen <[email protected]>
* util/bitset: Add a BITSET_FOREACH_SET macroJason Ekstrand2015-08-181-0/+36
| | | | Reviewed-by: Eric Anholt <[email protected]>
* util: replace Elements() with ARRAY_SIZE()Brian Paul2015-03-021-1/+1
| | | | Reviewed-by: Matt Turner <[email protected]>
* util: Move Mesa's bitset.h to util/.Eric Anholt2015-02-201-0/+99
Reviewed-by: Jose Fonseca <[email protected]>