diff mbox series

m68k: fix floatx80_mod() (Coverity CID1390568)

Message ID 20180508203937.16796-1-laurent@vivier.eu
State New
Headers show
Series m68k: fix floatx80_mod() (Coverity CID1390568) | expand

Commit Message

Laurent Vivier May 8, 2018, 8:39 p.m. UTC
Update the variable checked by the loop condition (expDiff).
Backport the update from Previous.

Fixes: 591596b77a ("target/m68k: add fmod/frem")
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 target/m68k/softfloat.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Thomas Huth May 9, 2018, 5:04 a.m. UTC | #1
On 08.05.2018 22:39, Laurent Vivier wrote:
> Update the variable checked by the loop condition (expDiff).
> Backport the update from Previous.
> 
> Fixes: 591596b77a ("target/m68k: add fmod/frem")
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  target/m68k/softfloat.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/target/m68k/softfloat.c b/target/m68k/softfloat.c
> index e41b07d042..d093997219 100644
> --- a/target/m68k/softfloat.c
> +++ b/target/m68k/softfloat.c
> @@ -103,6 +103,7 @@ floatx80 floatx80_mod(floatx80 a, floatx80 b, float_status *status)
>          mul64To128(bSig, qTemp, &term0, &term1);
>          sub128(aSig0, aSig1, term0, term1, &aSig0, &aSig1);
>          shortShift128Left(aSig0, aSig1, 62, &aSig0, &aSig1);
> +        expDiff -= 62;
>      }
>      expDiff += 64;
>      if (0 < expDiff) {

Reviewed-by: Thomas Huth <huth@tuxfamily.org>
diff mbox series

Patch

diff --git a/target/m68k/softfloat.c b/target/m68k/softfloat.c
index e41b07d042..d093997219 100644
--- a/target/m68k/softfloat.c
+++ b/target/m68k/softfloat.c
@@ -103,6 +103,7 @@  floatx80 floatx80_mod(floatx80 a, floatx80 b, float_status *status)
         mul64To128(bSig, qTemp, &term0, &term1);
         sub128(aSig0, aSig1, term0, term1, &aSig0, &aSig1);
         shortShift128Left(aSig0, aSig1, 62, &aSig0, &aSig1);
+        expDiff -= 62;
     }
     expDiff += 64;
     if (0 < expDiff) {