Source-Changes-HG archive

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

[src/trunk]: src/lib/libm/arch/hppa Simplify, now that rounding mode defines ...



details:   https://anonhg.NetBSD.org/src/rev/246345654c6c
branches:  trunk
changeset: 335554:246345654c6c
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jan 13 11:16:06 2015 +0000

description:
Simplify, now that rounding mode defines match the hardware bits.

diffstat:

 lib/libm/arch/hppa/fenv.c |  15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diffs (50 lines):

diff -r db1c87b994aa -r 246345654c6c lib/libm/arch/hppa/fenv.c
--- a/lib/libm/arch/hppa/fenv.c Tue Jan 13 11:15:29 2015 +0000
+++ b/lib/libm/arch/hppa/fenv.c Tue Jan 13 11:16:06 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fenv.c,v 1.1 2014/12/27 16:54:02 martin Exp $  */
+/*     $NetBSD: fenv.c,v 1.2 2015/01/13 11:16:06 martin Exp $  */
 
 /*-
  * Copyright (c) 2004-2005 David Schultz <das%FreeBSD.ORG@localhost>
@@ -24,7 +24,7 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: fenv.c,v 1.1 2014/12/27 16:54:02 martin Exp $");
+__RCSID("$NetBSD: fenv.c,v 1.2 2015/01/13 11:16:06 martin Exp $");
 
 #include <assert.h>
 #include <fenv.h>
@@ -41,11 +41,6 @@
 #define FE_ROUND_MASK  (FE_TONEAREST | FE_DOWNWARD | \
                        FE_UPWARD | FE_TOWARDZERO)
 
-/*
- * Our constants start at bit 0, while the fpsr bitfield starts at 9
- */
-#define        FE_ROUND_SHIFT  9
-
 /* Load lower 32 bits from floating-point state register */
 static inline uint32_t
 readfpsr(void)
@@ -209,7 +204,7 @@
 
        r = readfpsr();
 
-       return (r>>FE_ROUND_SHIFT) & FE_ROUND_MASK;
+       return r & FE_ROUND_MASK;
 }
 
 /*
@@ -227,8 +222,8 @@
                return -1;
 
        r = readfpsr();
-       r &= ~(FE_ROUND_MASK << FE_ROUND_SHIFT);
-       r |= round << FE_ROUND_SHIFT;
+       r &= ~FE_ROUND_MASK;
+       r |= round;
        writefpsr(r);
 
        /* Success */



Home | Main Index | Thread Index | Old Index