Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/m68k/include the FP_* constants need to be differen...



details:   https://anonhg.NetBSD.org/src/rev/599257f32fb5
branches:  trunk
changeset: 822036:599257f32fb5
user:      chs <chs%NetBSD.org@localhost>
date:      Mon Feb 27 06:47:58 2017 +0000

description:
the FP_* constants need to be different from the new FE_* constants
to preserve the ABI, so shift them as needed when using them.

diffstat:

 sys/arch/m68k/include/ieeefp.h |  24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diffs (40 lines):

diff -r cd53aec35b2c -r 599257f32fb5 sys/arch/m68k/include/ieeefp.h
--- a/sys/arch/m68k/include/ieeefp.h    Mon Feb 27 06:47:30 2017 +0000
+++ b/sys/arch/m68k/include/ieeefp.h    Mon Feb 27 06:47:58 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ieeefp.h,v 1.8 2015/12/25 06:03:06 christos Exp $      */
+/*     $NetBSD: ieeefp.h,v 1.9 2017/02/27 06:47:58 chs Exp $   */
 
 /* 
  * Written by J.T. Conklin, Apr 6, 1995
@@ -19,17 +19,21 @@
 
 typedef int fp_except;
 
-#define FP_X_IMP       FE_INEXACT      /* imprecise (loss of precision) */
-#define FP_X_DZ                FE_DIVBYZERO    /* divide-by-zero exception */
-#define FP_X_UFL       FE_UNDERFLOW    /* underflow exception */
-#define FP_X_OFL       FE_OVERFLOW     /* overflow exception */
-#define FP_X_INV       FE_INVALID      /* invalid operation exception */
+/* adjust for FP_* and FE_* value differences */ 
+#define        __FPE(x) ((x) >> 3)
+#define        __FPR(x) ((x) >> 4)
+
+#define FP_X_IMP       __FPE(FE_INEXACT)       /* imprecise (loss of precision) */
+#define FP_X_DZ                __FPE(FE_DIVBYZERO)     /* divide-by-zero exception */
+#define FP_X_UFL       __FPE(FE_UNDERFLOW)     /* underflow exception */
+#define FP_X_OFL       __FPE(FE_OVERFLOW)      /* overflow exception */
+#define FP_X_INV       __FPE(FE_INVALID)       /* invalid operation exception */
 
 typedef enum {
-    FP_RN=FE_TONEAREST,                /* round to nearest representable number */
-    FP_RZ=FE_TOWARDZERO,       /* round to zero (truncate) */
-    FP_RM=FE_DOWNWARD,         /* round toward negative infinity */
-    FP_RP=FE_UPWARD            /* round toward positive infinity */
+    FP_RN=__FPR(FE_TONEAREST), /* round to nearest representable number */
+    FP_RZ=__FPR(FE_TOWARDZERO),        /* round to zero (truncate) */
+    FP_RM=__FPR(FE_DOWNWARD),  /* round toward negative infinity */
+    FP_RP=__FPR(FE_UPWARD)     /* round toward positive infinity */
 } fp_rnd;
 
 typedef enum {



Home | Main Index | Thread Index | Old Index