diff options
| author | Eric Engestrom <eric@igalia.com> | 2023-05-22 19:51:15 +0100 |
|---|---|---|
| committer | Marge Bot <emma+marge@anholt.net> | 2023-05-23 17:31:17 +0000 |
| commit | ca856143d498694fd121208a949edc9a7aa8c432 (patch) | |
| tree | 9b7b88b05d97823631887317277985575473e837 /src/util/bitset.h | |
| parent | 348818fc6c56b818ed9f103196a8e45a6b92289b (diff) | |
util/bitset: ensure the sets compared have the same size at compile time
Instead of checking this at run time.
Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23171>
Diffstat (limited to 'src/util/bitset.h')
| -rw-r--r-- | src/util/bitset.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/util/bitset.h b/src/util/bitset.h index 9765345dc1d..64d0d2212e2 100644 --- a/src/util/bitset.h +++ b/src/util/bitset.h @@ -91,15 +91,15 @@ __bitset_not(BITSET_WORD *x, unsigned n) #define BITSET_AND(r, x, y) \ do { \ - assert(ARRAY_SIZE(r) == ARRAY_SIZE(x)); \ - assert(ARRAY_SIZE(r) == ARRAY_SIZE(y)); \ + STATIC_ASSERT(ARRAY_SIZE(r) == ARRAY_SIZE(x)); \ + STATIC_ASSERT(ARRAY_SIZE(r) == ARRAY_SIZE(y)); \ __bitset_and(r, x, y, ARRAY_SIZE(r)); \ } while (0) #define BITSET_OR(r, x, y) \ do { \ - assert(ARRAY_SIZE(r) == ARRAY_SIZE(x)); \ - assert(ARRAY_SIZE(r) == ARRAY_SIZE(y)); \ + STATIC_ASSERT(ARRAY_SIZE(r) == ARRAY_SIZE(x)); \ + STATIC_ASSERT(ARRAY_SIZE(r) == ARRAY_SIZE(y)); \ __bitset_or(r, x, y, ARRAY_SIZE(r)); \ } while (0) |