mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 18:00:10 +01:00
nir/builder: Assert that intN_t immediates fit
This assert won't catch all mistakes with this helper but it will at least ensure that the top bits are all zero or all one which should help catch bugs. Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
This commit is contained in:
parent
4266932c0b
commit
1f29f4db1e
1 changed files with 4 additions and 0 deletions
|
|
@ -330,6 +330,10 @@ nir_imm_intN_t(nir_builder *build, uint64_t x, unsigned bit_size)
|
|||
{
|
||||
nir_const_value v;
|
||||
|
||||
assert(bit_size == 64 ||
|
||||
(int64_t)x >> bit_size == 0 ||
|
||||
(int64_t)x >> bit_size == -1);
|
||||
|
||||
memset(&v, 0, sizeof(v));
|
||||
assert(bit_size <= 64);
|
||||
v.i64[0] = x & (~0ull >> (64 - bit_size));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue