qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] softfloat: Use correct type in float64_to_uint64_round_to_zero()
@ 2017-02-03 18:59 Peter Maydell
  2017-02-05 18:03 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Maydell @ 2017-02-03 18:59 UTC (permalink / raw)
  To: qemu-devel, qemu-trivial; +Cc: patches

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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Spotted while reading the code...

 fpu/softfloat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index c295f31..218b375 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -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;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] softfloat: Use correct type in float64_to_uint64_round_to_zero()
  2017-02-03 18:59 [Qemu-devel] [PATCH] softfloat: Use correct type in float64_to_uint64_round_to_zero() Peter Maydell
@ 2017-02-05 18:03 ` Laurent Vivier
  2017-02-09 22:15 ` [Qemu-devel] " Philippe Mathieu-Daudé
  2017-02-15 10:12 ` Michael Tokarev
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2017-02-05 18:03 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel, qemu-trivial; +Cc: patches

Le 03/02/2017 à 19:59, Peter Maydell a écrit :
> 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.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

> ---
> Spotted while reading the code...
> 
>  fpu/softfloat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index c295f31..218b375 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -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;
>  }
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] softfloat: Use correct type in float64_to_uint64_round_to_zero()
  2017-02-03 18:59 [Qemu-devel] [PATCH] softfloat: Use correct type in float64_to_uint64_round_to_zero() Peter Maydell
  2017-02-05 18:03 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
@ 2017-02-09 22:15 ` Philippe Mathieu-Daudé
  2017-02-15 10:12 ` Michael Tokarev
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-02-09 22:15 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel, qemu-trivial; +Cc: patches

On 02/03/2017 03:59 PM, Peter Maydell wrote:
> 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.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
> Spotted while reading the code...
>
>  fpu/softfloat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index c295f31..218b375 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -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;
>  }
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] softfloat: Use correct type in float64_to_uint64_round_to_zero()
  2017-02-03 18:59 [Qemu-devel] [PATCH] softfloat: Use correct type in float64_to_uint64_round_to_zero() Peter Maydell
  2017-02-05 18:03 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
  2017-02-09 22:15 ` [Qemu-devel] " Philippe Mathieu-Daudé
@ 2017-02-15 10:12 ` Michael Tokarev
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2017-02-15 10:12 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel, qemu-trivial; +Cc: patches

03.02.2017 21:59, Peter Maydell wrote:
> 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.

Applied to -trivial, thanks!

/mjt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-15 10:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-03 18:59 [Qemu-devel] [PATCH] softfloat: Use correct type in float64_to_uint64_round_to_zero() Peter Maydell
2017-02-05 18:03 ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
2017-02-09 22:15 ` [Qemu-devel] " Philippe Mathieu-Daudé
2017-02-15 10:12 ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).