mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 04:58:05 +02:00
util: fix UBSan error with _mesa_bfloat16_bits_to_float
runtime error: left shift of 65535 by 16 places cannot be represented in type 'int' This fixes nir_opt_algebraic_pattern_test.bf2f. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Fixes:ecd2d2cf46("util: Add functions to convert float to/from bfloat16") Reviewed-by: Georg Lehmann <dadschoorse@gmail.com> (cherry picked from commit72f2b8a034) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
This commit is contained in:
parent
92bfcb208f
commit
eb4618b1b5
2 changed files with 2 additions and 2 deletions
|
|
@ -3324,7 +3324,7 @@
|
|||
"description": "util: fix UBSan error with _mesa_bfloat16_bits_to_float",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "ecd2d2cf46dfc3305a6dc1497815b7b54eef513e",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ static inline float
|
|||
_mesa_bfloat16_bits_to_float(uint16_t bf)
|
||||
{
|
||||
union fi x;
|
||||
x.ui = bf << 16;
|
||||
x.ui = (uint32_t)bf << 16;
|
||||
|
||||
return x.f;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue