Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hppa/include Properly separate fenv.h and ieeefp.h ...



details:   https://anonhg.NetBSD.org/src/rev/db1c87b994aa
branches:  trunk
changeset: 335553:db1c87b994aa
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jan 13 11:15:29 2015 +0000

description:
Properly separate fenv.h and ieeefp.h by moving all fenv defines
over to the former.
Now that they are decoupled, make rounding modes match the hardware bits.

diffstat:

 sys/arch/hppa/include/fenv.h   |  20 ++++++++++++++++++--
 sys/arch/hppa/include/ieeefp.h |  36 ++++++++++--------------------------
 2 files changed, 28 insertions(+), 28 deletions(-)

diffs (89 lines):

diff -r 166ed7aafe6a -r db1c87b994aa sys/arch/hppa/include/fenv.h
--- a/sys/arch/hppa/include/fenv.h      Tue Jan 13 10:37:38 2015 +0000
+++ b/sys/arch/hppa/include/fenv.h      Tue Jan 13 11:15:29 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fenv.h,v 1.1 2014/12/27 16:54:03 martin Exp $  */
+/*     $NetBSD: fenv.h,v 1.2 2015/01/13 11:15:29 martin Exp $  */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,23 @@
 #define        _HPPA_FENV_H_
 
 #include <sys/stdint.h>
-#include <machine/ieeefp.h>
+
+typedef unsigned fenv_t;
+typedef unsigned fexcept_t;
+
+#define        FE_INEXACT      0x01    /* imprecise (loss of precision) */
+#define        FE_UNDERFLOW    0x02    /* underflow exception */
+#define        FE_OVERFLOW     0x04    /* overflow exception */
+#define        FE_DIVBYZERO    0x08    /* divide-by-zero exception */
+#define        FE_INVALID      0x10    /* invalid operation exception */
+
+#define        FE_ALL_EXCEPT   0x1f
+
+#define        FE_TONEAREST    (0)     /* round to nearest representable number */
+#define        FE_TOWARDZERO   (1<<9)  /* round to zero (truncate) */
+#define        FE_UPWARD       (2<<9)  /* round toward positive infinity */
+#define        FE_DOWNWARD     (3<<9)  /* round toward negative infinity */
+
 
 __BEGIN_DECLS
 
diff -r 166ed7aafe6a -r db1c87b994aa sys/arch/hppa/include/ieeefp.h
--- a/sys/arch/hppa/include/ieeefp.h    Tue Jan 13 10:37:38 2015 +0000
+++ b/sys/arch/hppa/include/ieeefp.h    Tue Jan 13 11:15:29 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ieeefp.h,v 1.6 2015/01/12 09:14:45 mrg Exp $   */
+/*     $NetBSD: ieeefp.h,v 1.7 2015/01/13 11:15:29 martin Exp $        */
 
 /* 
  * Written by J.T. Conklin, Apr 6, 1995
@@ -12,36 +12,20 @@
 
 #if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
 
-typedef unsigned fenv_t;
-typedef unsigned fexcept_t;
-
-#define        FE_INEXACT      0x01    /* imprecise (loss of precision) */
-#define        FE_UNDERFLOW    0x02    /* underflow exception */
-#define        FE_OVERFLOW     0x04    /* overflow exception */
-#define        FE_DIVBYZERO    0x08    /* divide-by-zero exception */
-#define        FE_INVALID      0x10    /* invalid operation exception */
-
-#define        FE_ALL_EXCEPT   0x1f
-
-#define        FE_TONEAREST    0       /* round to nearest representable number */
-#define        FE_TOWARDZERO   1       /* round to zero (truncate) */
-#define        FE_UPWARD       2       /* round toward positive infinity */
-#define        FE_DOWNWARD     3       /* round toward negative infinity */
-
 #if !defined(_ISOC99_SOURCE)
 
 typedef int fp_except;
-#define FP_X_INV       FE_INVALID      /* invalid operation exception */
-#define FP_X_DZ                FE_DIVBYZERO    /* divide-by-zero exception */
-#define FP_X_OFL       FE_OVERFLOW     /* overflow exception */
-#define FP_X_UFL       FE_UNDERFLOW    /* underflow exception */
-#define FP_X_IMP       FE_INEXACT      /* imprecise (loss of precision) */
+#define FP_X_INV       0x10            /* invalid operation exception */
+#define FP_X_DZ                0x08            /* divide-by-zero exception */
+#define FP_X_OFL       0x04            /* overflow exception */
+#define FP_X_UFL       0x02            /* underflow exception */
+#define FP_X_IMP       0x01            /* imprecise (loss of precision) */
 
 typedef enum {
-    FP_RN=FE_TONEAREST,                /* round to nearest representable number */
-    FP_RZ=FE_TOWARDZERO,       /* round to zero (truncate) */
-    FP_RP=FE_UPWARD,           /* round toward positive infinity */
-    FP_RM=FE_DOWNWARD          /* round toward negative infinity */
+    FP_RN=0,                   /* round to nearest representable number */
+    FP_RZ=1,                   /* round to zero (truncate) */
+    FP_RP=2,                   /* round toward positive infinity */
+    FP_RM=3                    /* round toward negative infinity */
 } fp_rnd;
 
 #endif /* !_ISOC99_SOURCE */



Home | Main Index | Thread Index | Old Index