mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
softfloat: make sign bit an unsigned int
According to ubsan shifting an int32_t by 31 bits to the left is undefined behavior. So just declare it as uint32_t. Backport-to: 26.1 Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41252>
This commit is contained in:
parent
7c69f31ecc
commit
b2aa92b523
1 changed files with 5 additions and 3 deletions
|
|
@ -153,7 +153,7 @@ double _mesa_roundtozero_f64(int64_t s, int64_t e, int64_t m)
|
|||
* \brief Extracted from softfloat_roundPackToF32()
|
||||
*/
|
||||
static inline
|
||||
float _mesa_round_f32(int32_t s, int32_t e, int32_t m, bool rtz)
|
||||
float _mesa_round_f32(uint32_t s, int32_t e, int32_t m, bool rtz)
|
||||
{
|
||||
fi_type result;
|
||||
uint8_t round_increment = rtz ? 0 : 0x40;
|
||||
|
|
@ -1192,7 +1192,8 @@ _mesa_float_fma_rtz(float a, float b, float c)
|
|||
uint32_t c_flt_m = c_fi.u & 0x07fffff;
|
||||
uint32_t c_flt_e = (c_fi.u >> 23) & 0xff;
|
||||
uint32_t c_flt_s = (c_fi.u >> 31) & 0x1;
|
||||
int32_t s, e, m = 0;
|
||||
uint32_t s;
|
||||
int32_t e, m = 0;
|
||||
|
||||
c_flt_s ^= 0;
|
||||
s = a_flt_s ^ b_flt_s ^ 0;
|
||||
|
|
@ -1371,7 +1372,8 @@ _mesa_double_to_f32(double val, bool rtz)
|
|||
uint64_t flt_m = di.u & 0x0fffffffffffff;
|
||||
uint64_t flt_e = (di.u >> 52) & 0x7ff;
|
||||
uint64_t flt_s = (di.u >> 63) & 0x1;
|
||||
int32_t s, e, m = 0;
|
||||
uint32_t s;
|
||||
int32_t e, m = 0;
|
||||
|
||||
s = flt_s;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue