aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_format_convert.h
diff options
context:
space:
mode:
authorIcecream95 <[email protected]>2020-02-26 19:29:03 +1300
committerMarge Bot <[email protected]>2020-02-28 11:52:40 +0000
commit574b03eebfba1a4b9de1a497857f0bbdca76ef19 (patch)
treee423af9c2e45dae5606a450e7bbb128733d5a308 /src/compiler/nir/nir_format_convert.h
parentcf69b9635a7fca9b865fe673073f1baff83bf759 (diff)
nir: Allow nir_format conversions to work on 32-bit values
The constant has to changed to unsigned long long, as shifting a 32-bit value by 32 is undefined behaviour. Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3943>
Diffstat (limited to 'src/compiler/nir/nir_format_convert.h')
-rw-r--r--src/compiler/nir/nir_format_convert.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_format_convert.h b/src/compiler/nir/nir_format_convert.h
index 23f85ada8d8..a9de69e695f 100644
--- a/src/compiler/nir/nir_format_convert.h
+++ b/src/compiler/nir/nir_format_convert.h
@@ -214,8 +214,8 @@ _nir_format_norm_factor(nir_builder *b, const unsigned *bits,
nir_const_value factor[NIR_MAX_VEC_COMPONENTS];
memset(factor, 0, sizeof(factor));
for (unsigned i = 0; i < num_components; i++) {
- assert(bits[i] < 32);
- factor[i].f32 = (1ul << (bits[i] - is_signed)) - 1;
+ assert(bits[i] <= 32);
+ factor[i].f32 = (1ull << (bits[i] - is_signed)) - 1;
}
return nir_build_imm(b, num_components, 32, factor);
}