softfloat: Use correct type in float64_to_uint64_round_to_zero()
PATCH 1/1 softfloat: Use correct type in float64_to_uint64_round_to_zero()
In float64_to_uint64_round_to_zero() a typo meant that we were taking the uint64_t return value from float64_to_uint64() and putting it into an int64_t variable before returning it as uint64_t again. Use uint64_t instead of pointlessly casting it back and forth to int64_t.
---
Spotted while reading the code...
fpu/softfloat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fpu/softfloat.c +1 -1
@@ -7386,7 +7386,7 @@ uint64_t float64_to_uint64_round_to_zero(float64 a, float_status *status) {signed char current_rounding_mode = status->float_rounding_mode;set_float_rounding_mode (float_round_to_zero, status); -int64_t v =float64_to_uint64 (a, status); +uint64_t v =float64_to_uint64 (a, status);set_float_rounding_mode (current_rounding_mode, status);return v; }
Signature · 1 line
2.7.4
Quoted 7 lines · Peter Maydell
In
float64_to_uint64_round_to_zero()a typo meant that we were taking theuint64_treturn value fromfloat64_to_uint64()and putting it into anint64_tvariable before returning it asuint64_tagain. Useuint64_tinstead of pointlessly casting it back and forth toint64_t.Signed-off-by Peter Maydell <[email protected]>
Quoted 20 lines
---
Spotted while reading the code...fpu/softfloat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fpu/softfloat.c +1
-1@@ -7386,7 +7386,7 @@ uint64_t float64_to_uint64_round_to_zero(float64 a, float_status *status) {signed char current_rounding_mode = status->float_rounding_mode;set_float_rounding_mode (float_round_to_zero, status); -int64_t v =float64_to_uint64 (a, status); +uint64_t v =float64_to_uint64 (a, status);set_float_rounding_mode (current_rounding_mode, status);return v; }
Quoted 7 lines · Peter Maydell
In
float64_to_uint64_round_to_zero()a typo meant that we were taking theuint64_treturn value fromfloat64_to_uint64()and putting it into anint64_tvariable before returning it asuint64_tagain. Useuint64_tinstead of pointlessly casting it back and forth toint64_t.Signed-off-by Peter Maydell <[email protected]>
Quoted 20 lines
---
Spotted while reading the code...fpu/softfloat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fpu/softfloat.c +1
-1@@ -7386,7 +7386,7 @@ uint64_t float64_to_uint64_round_to_zero(float64 a, float_status *status) {signed char current_rounding_mode = status->float_rounding_mode;set_float_rounding_mode (float_round_to_zero, status); -int64_t v =float64_to_uint64 (a, status); +uint64_t v =float64_to_uint64 (a, status);set_float_rounding_mode (current_rounding_mode, status);return v; }
Michael Tokarev
AppliedQuoted 5 lines · Peter Maydell
In
float64_to_uint64_round_to_zero()a typo meant that we were taking theuint64_treturn value fromfloat64_to_uint64()and putting it into anint64_tvariable before returning it asuint64_tagain. Useuint64_tinstead of pointlessly casting it back and forth toint64_t.
Applied to -trivial, thanks!
/mjt