Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/arch/mips/gen Use ieee.h.



details:   https://anonhg.NetBSD.org/src/rev/3544cfde68fb
branches:  trunk
changeset: 475901:3544cfde68fb
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Sun Aug 29 18:23:26 1999 +0000

description:
Use ieee.h.

diffstat:

 lib/libc/arch/mips/gen/frexp.c |  34 +++++++++++-----------------------
 1 files changed, 11 insertions(+), 23 deletions(-)

diffs (67 lines):

diff -r e3613b6bedd6 -r 3544cfde68fb lib/libc/arch/mips/gen/frexp.c
--- a/lib/libc/arch/mips/gen/frexp.c    Sun Aug 29 18:21:20 1999 +0000
+++ b/lib/libc/arch/mips/gen/frexp.c    Sun Aug 29 18:23:26 1999 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: frexp.c,v 1.3 1997/07/13 18:45:24 christos Exp $       */
+/*     $NetBSD: frexp.c,v 1.4 1999/08/29 18:23:26 mycroft Exp $        */
 
 /*-
- * Copyright (c) 1991, 1993
- *     The Regents of the University of California.  All rights reserved.
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,14 +36,14 @@
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
 #if 0
-static char sccsid[] = "@(#)frexp.c    8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)frexp.c    5.1 (Berkeley) 3/7/91";
 #else
-__RCSID("$NetBSD: frexp.c,v 1.3 1997/07/13 18:45:24 christos Exp $");
+__RCSID("$NetBSD: frexp.c,v 1.4 1999/08/29 18:23:26 mycroft Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
-#include <machine/endian.h>
+#include <machine/ieee.h>
 #include <math.h>
 
 double
@@ -53,28 +53,16 @@
 {
        union {
                 double v;
-                struct {
-#if BYTE_ORDER == LITTLE_ENDIAN
-                       u_int u_mant2 : 32;
-                       u_int u_mant1 : 20;
-                       u_int   u_exp : 11;
-                        u_int  u_sign :  1;
-#else
-                        u_int  u_sign :  1;
-                       u_int   u_exp : 11;
-                       u_int u_mant1 : 20;
-                       u_int u_mant2 : 32;
-#endif
-                } s;
+                struct ieee_double s;
         } u;
 
        if (value) {
                u.v = value;
-               *eptr = u.s.u_exp - 1022;
-               u.s.u_exp = 1022;
-               return(u.v);
+               *eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
+               u.s.dbl_exp = DBL_EXP_BIAS - 1;
+               return (u.v);
        } else {
                *eptr = 0;
-               return((double)0);
+               return (0.0);
        }
 }



Home | Main Index | Thread Index | Old Index