Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/m68k/fpe Fix a wrong "raw" comparison in step3.2.



details:   https://anonhg.NetBSD.org/src/rev/21c81d98d965
branches:  trunk
changeset: 785711:21c81d98d965
user:      isaki <isaki%NetBSD.org@localhost>
date:      Tue Mar 26 10:57:13 2013 +0000

description:
Fix a wrong "raw" comparison in step3.2.
It should solve a PR kern/47692.

diffstat:

 sys/arch/m68k/fpe/fpu_rem.c |  21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diffs (50 lines):

diff -r 0721cafe8de5 -r 21c81d98d965 sys/arch/m68k/fpe/fpu_rem.c
--- a/sys/arch/m68k/fpe/fpu_rem.c       Tue Mar 26 02:05:48 2013 +0000
+++ b/sys/arch/m68k/fpe/fpu_rem.c       Tue Mar 26 10:57:13 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu_rem.c,v 1.11 2011/07/18 14:11:27 isaki Exp $       */
+/*     $NetBSD: fpu_rem.c,v 1.12 2013/03/26 10:57:13 isaki Exp $       */
 
 /*
  * Copyright (c) 1995  Ken Nakata
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu_rem.c,v 1.11 2011/07/18 14:11:27 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_rem.c,v 1.12 2013/03/26 10:57:13 isaki Exp $");
 
 #include <sys/types.h>
 #include <sys/signal.h>
@@ -92,6 +92,7 @@
 {
        static struct fpn X, Y;
        struct fpn *x, *y, *r;
+       struct fpn r_bkup;
        u_int signX, signY, signQ;
        int j, k, l, q;
        int Last_Subtract;
@@ -130,15 +131,15 @@
                       y->fp_mant[2] != r->fp_mant[2]) {
 
                        /* Step 3.2 */
-                       if (y->fp_exp < r->fp_exp ||
-                           y->fp_mant[0] < r->fp_mant[0] ||
-                           y->fp_mant[1] < r->fp_mant[1] ||
-                           y->fp_mant[2] < r->fp_mant[2]) {
-                               CPYFPN(&fe->fe_f1, r);
-                               CPYFPN(&fe->fe_f2, y);
-                               fe->fe_f2.fp_sign = 1;
-                               r = fpu_add(fe);
+                       CPYFPN(&r_bkup, r);
+                       CPYFPN(&fe->fe_f1, r);
+                       CPYFPN(&fe->fe_f2, y);
+                       fe->fe_f2.fp_sign = 1;
+                       r = fpu_add(fe);
+                       if (r->fp_sign == 0) {
                                q++;
+                       } else {
+                               CPYFPN(r, &r_bkup);
                        }
 
                        /* Step 3.3 */



Home | Main Index | Thread Index | Old Index