All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value
Date: Mon, 24 Sep 2012 19:23:43 +0200	[thread overview]
Message-ID: <20120924172343.GC23241@ohm.aurel32.net> (raw)
In-Reply-To: <1348504115-13203-1-git-send-email-peter.maydell@linaro.org>

On Mon, Sep 24, 2012 at 05:28:35PM +0100, Peter Maydell wrote:
> In float16_to_float32, when returning an infinity, just pass zero
> as the mantissa argument to packFloat32(), rather than shifting
> a value which we know must be zero.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Spotted by the clang static analyzer. This brings this code into line with
> the other float-to-float conversion functions and was probably a harmless
> cut-n-paste error from the normal-return codepath.
> 
>  fpu/softfloat.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index b29256a..01a28ca 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -3007,7 +3007,7 @@ float32 float16_to_float32(float16 a, flag ieee STATUS_PARAM)
>          if (aSig) {
>              return commonNaNToFloat32(float16ToCommonNaN(a STATUS_VAR) STATUS_VAR);
>          }
> -        return packFloat32(aSign, 0xff, aSig << 13);
> +        return packFloat32(aSign, 0xff, 0);
>      }
>      if (aExp == 0) {
>          int8 shiftCount;
> -- 
> 1.7.9.5

Good catch!

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net


WARNING: multiple messages have this Message-ID (diff)
From: Aurelien Jarno <aurelien@aurel32.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value
Date: Mon, 24 Sep 2012 19:23:43 +0200	[thread overview]
Message-ID: <20120924172343.GC23241@ohm.aurel32.net> (raw)
In-Reply-To: <1348504115-13203-1-git-send-email-peter.maydell@linaro.org>

On Mon, Sep 24, 2012 at 05:28:35PM +0100, Peter Maydell wrote:
> In float16_to_float32, when returning an infinity, just pass zero
> as the mantissa argument to packFloat32(), rather than shifting
> a value which we know must be zero.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> Spotted by the clang static analyzer. This brings this code into line with
> the other float-to-float conversion functions and was probably a harmless
> cut-n-paste error from the normal-return codepath.
> 
>  fpu/softfloat.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index b29256a..01a28ca 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -3007,7 +3007,7 @@ float32 float16_to_float32(float16 a, flag ieee STATUS_PARAM)
>          if (aSig) {
>              return commonNaNToFloat32(float16ToCommonNaN(a STATUS_VAR) STATUS_VAR);
>          }
> -        return packFloat32(aSign, 0xff, aSig << 13);
> +        return packFloat32(aSign, 0xff, 0);
>      }
>      if (aExp == 0) {
>          int8 shiftCount;
> -- 
> 1.7.9.5

Good catch!

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  parent reply	other threads:[~2012-09-24 17:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-24 16:28 [Qemu-trivial] [PATCH] fpu/softfloat.c: Remove pointless shift of always-zero value Peter Maydell
2012-09-24 16:28 ` [Qemu-devel] " Peter Maydell
2012-09-24 16:43 ` [Qemu-trivial] " Richard Henderson
2012-09-24 16:43   ` Richard Henderson
2012-09-24 17:23 ` Aurelien Jarno [this message]
2012-09-24 17:23   ` Aurelien Jarno
2012-10-01 20:12 ` [Qemu-trivial] " Aurelien Jarno
2012-10-01 20:12   ` Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120924172343.GC23241@ohm.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.