mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 20:18:12 +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>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40740>
This commit is contained in:
parent
ca6edbd9c8
commit
72f2b8a034
1 changed files with 1 additions and 1 deletions
|
|
@ -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