Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/arch/ns32k/gen Separate isnan() into a separate mod...



details:   https://anonhg.NetBSD.org/src/rev/d53e140c66b9
branches:  trunk
changeset: 475896:d53e140c66b9
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Sun Aug 29 18:11:28 1999 +0000

description:
Separate isnan() into a separate module, and make isinf()/isnan() use ieee.h.

diffstat:

 lib/libc/arch/ns32k/gen/Makefile.inc |   4 +-
 lib/libc/arch/ns32k/gen/isinf.c      |  44 +++++++++++++----------------------
 2 files changed, 18 insertions(+), 30 deletions(-)

diffs (94 lines):

diff -r 08f03704d066 -r d53e140c66b9 lib/libc/arch/ns32k/gen/Makefile.inc
--- a/lib/libc/arch/ns32k/gen/Makefile.inc      Sun Aug 29 18:10:33 1999 +0000
+++ b/lib/libc/arch/ns32k/gen/Makefile.inc      Sun Aug 29 18:11:28 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.9 1999/01/22 14:22:36 jonb Exp $
+#      $NetBSD: Makefile.inc,v 1.10 1999/08/29 18:11:28 mycroft Exp $
 
 # objects built from assembler sources (need lint stubs)
 ASSRCS+=alloca.S fabs.S frexp.S ldexp.S modf.S
@@ -12,4 +12,4 @@
 
 # objects built from C sources
 SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
-       fpsetround.c fpsetsticky.c infinity.c isinf.c bswap64.c
+       fpsetround.c fpsetsticky.c infinity.c isinf.c isnan.c bswap64.c
diff -r 08f03704d066 -r d53e140c66b9 lib/libc/arch/ns32k/gen/isinf.c
--- a/lib/libc/arch/ns32k/gen/isinf.c   Sun Aug 29 18:10:33 1999 +0000
+++ b/lib/libc/arch/ns32k/gen/isinf.c   Sun Aug 29 18:11:28 1999 +0000
@@ -1,8 +1,12 @@
-/*     $NetBSD: isinf.c,v 1.7 1998/11/14 19:31:02 christos Exp $       */
+/*     $NetBSD: isinf.c,v 1.8 1999/08/29 18:11:28 mycroft Exp $        */
 
-/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
+/*
+ * Copyright (c) 1992, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This software was developed by the Computer Systems Engineering group
+ * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
+ * contributed to Berkeley.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -31,50 +35,34 @@
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
+ *
+ * from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
  */
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
 #if 0
-static char sccsid[] = "@(#)isinf.c    5.1 (Berkeley) 3/18/91";
+static char sccsid[] = "@(#)isinf.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: isinf.c,v 1.7 1998/11/14 19:31:02 christos Exp $");
+__RCSID("$NetBSD: isinf.c,v 1.8 1999/08/29 18:11:28 mycroft Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 #include <sys/types.h>
+#include <machine/ieee.h>
 #include <math.h>
 
 #ifdef __weak_alias
-__weak_alias(isnan,_isnan);
 __weak_alias(isinf,_isinf);
 #endif
 
 int
-isnan(d)
-       double d;
-{
-       register struct IEEEdp {
-               u_int manl : 32;
-               u_int manh : 20;
-               u_int  exp : 11;
-               u_int sign :  1;
-       } *p = (struct IEEEdp *)(void *)&d;
-
-       return(p->exp == 2047 && (p->manh || p->manl));
-}
-
-int
 isinf(d)
        double d;
 {
-       register struct IEEEdp {
-               u_int manl : 32;
-               u_int manh : 20;
-               u_int  exp : 11;
-               u_int sign :  1;
-       } *p = (struct IEEEdp *)(void *)&d;
+       register struct ieee_double *p = (struct ieee_double *)(void *)&d;
 
-       return(p->exp == 2047 && !p->manh && !p->manl);
+       return (p->dbl_exp == DBL_EXP_INFNAN &&
+           (p->dbl_frach == 0 && p->dbl_fracl == 0));
 }



Home | Main Index | Thread Index | Old Index