Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/arch Separate isnan() into a separate module, and m...



details:   https://anonhg.NetBSD.org/src/rev/02944b153531
branches:  trunk
changeset: 475894:02944b153531
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Sun Aug 29 18:08:27 1999 +0000

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

diffstat:

 lib/libc/arch/alpha/gen/Makefile.inc |   4 +-
 lib/libc/arch/alpha/gen/isinf.c      |  80 ++++++++++++++++++++---------------
 lib/libc/arch/alpha/gen/isnan.c      |  68 ++++++++++++++++++++++++++++++
 lib/libc/arch/arm32/gen/Makefile.inc |   4 +-
 lib/libc/arch/arm32/gen/isinf.c      |  41 ++++++++++-------
 lib/libc/arch/arm32/gen/isnan.c      |  68 ++++++++++++++++++++++++++++++
 lib/libc/arch/i386/gen/Makefile.inc  |   4 +-
 lib/libc/arch/i386/gen/isinf.c       |  44 +++++++------------
 lib/libc/arch/i386/gen/isnan.c       |  68 ++++++++++++++++++++++++++++++
 lib/libc/arch/m68k/gen/Makefile.inc  |   4 +-
 lib/libc/arch/m68k/gen/isinf.c       |  44 +++++++------------
 lib/libc/arch/m68k/gen/isnan.c       |  68 ++++++++++++++++++++++++++++++
 lib/libc/arch/powerpc/gen/isinf.c    |   6 +-
 lib/libc/arch/powerpc/gen/isnan.c    |  10 ++--
 lib/libc/arch/sparc/gen/isinf.c      |   8 +-
 lib/libc/arch/sparc/gen/isnan.c      |  12 ++--
 lib/libc/arch/sparc64/gen/isinf.c    |   8 +-
 lib/libc/arch/sparc64/gen/isnan.c    |  12 ++--
 18 files changed, 409 insertions(+), 144 deletions(-)

diffs (truncated from 913 to 300 lines):

diff -r c9d390a40277 -r 02944b153531 lib/libc/arch/alpha/gen/Makefile.inc
--- a/lib/libc/arch/alpha/gen/Makefile.inc      Sun Aug 29 17:57:25 1999 +0000
+++ b/lib/libc/arch/alpha/gen/Makefile.inc      Sun Aug 29 18:08:27 1999 +0000
@@ -1,6 +1,6 @@
-#      $NetBSD: Makefile.inc,v 1.5 1999/01/15 13:31:15 bouyer Exp $
+#      $NetBSD: Makefile.inc,v 1.6 1999/08/29 18:08:27 mycroft Exp $
 
-SRCS+= fabs.S frexp.c infinity.c isinf.c ldexp.c modf.c
+SRCS+= fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c modf.c
 SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
        fpsetround.c fpsetsticky.c
 SRCS+= _setjmp.S
diff -r c9d390a40277 -r 02944b153531 lib/libc/arch/alpha/gen/isinf.c
--- a/lib/libc/arch/alpha/gen/isinf.c   Sun Aug 29 17:57:25 1999 +0000
+++ b/lib/libc/arch/alpha/gen/isinf.c   Sun Aug 29 18:08:27 1999 +0000
@@ -1,58 +1,68 @@
-/*     $NetBSD: isinf.c,v 1.3 1998/11/14 19:31:01 christos Exp $       */
+/*     $NetBSD: isinf.c,v 1.4 1999/08/29 18:08:28 mycroft Exp $        */
 
 /*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
- * Author: Chris G. Demetriou
- * 
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- * 
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
- * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- * 
- * Carnegie Mellon requests users of this software to return to
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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.
  *
- *  Software Distribution Coordinator  or  Software.Distribution%CS.CMU.EDU@localhost
- *  School of Computer Science
- *  Carnegie Mellon University
- *  Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
+ * 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    8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: isinf.c,v 1.4 1999/08/29 18:08: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 ieee_double *p = (struct ieee_double *)(void *)&d;
-
-       return (p->dbl_exp == DBL_EXP_INFNAN &&
-           (p->dbl_frach || p->dbl_fracl));
-}
-
-int
 isinf(d)
        double d;
 {
        register struct ieee_double *p = (struct ieee_double *)(void *)&d;
 
        return (p->dbl_exp == DBL_EXP_INFNAN &&
-           !p->dbl_frach && !p->dbl_fracl);
+           (p->dbl_frach == 0 && p->dbl_fracl == 0));
 }
diff -r c9d390a40277 -r 02944b153531 lib/libc/arch/alpha/gen/isnan.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/alpha/gen/isnan.c   Sun Aug 29 18:08:27 1999 +0000
@@ -0,0 +1,68 @@
+/*     $NetBSD: isnan.c,v 1.1 1999/08/29 18:08:28 mycroft Exp $        */
+
+/*
+ * 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
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * 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    8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: isnan.c,v 1.1 1999/08/29 18:08: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);
+#endif
+
+int
+isnan(d)
+       double d;
+{
+       register struct ieee_double *p = (struct ieee_double *)(void *)&d;
+
+       return (p->dbl_exp == DBL_EXP_INFNAN &&
+           (p->dbl_frach != 0 || p->dbl_fracl != 0));
+}
diff -r c9d390a40277 -r 02944b153531 lib/libc/arch/arm32/gen/Makefile.inc
--- a/lib/libc/arch/arm32/gen/Makefile.inc      Sun Aug 29 17:57:25 1999 +0000
+++ b/lib/libc/arch/arm32/gen/Makefile.inc      Sun Aug 29 18:08:27 1999 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile.inc,v 1.6 1999/01/15 13:31:16 bouyer Exp $
+# $NetBSD: Makefile.inc,v 1.7 1999/08/29 18:08:29 mycroft Exp $
 
 SRCS+= alloca.S byte_swap_2.S byte_swap_4.S bswap64.c divsi3.S \
        fabs.c flt_rounds.c fpgetround.c fpsetround.c \
        fpgetmask.S fpsetmask.S fpgetsticky.S fpsetsticky.S \
-       infinity.c isinf.c frexp.c ldexp.c modf.c
+       infinity.c isinf.c isnan.c frexp.c ldexp.c modf.c
 
 SRCS+= setjmp.S __setjmp14.S
 SRCS+= _setjmp.S
diff -r c9d390a40277 -r 02944b153531 lib/libc/arch/arm32/gen/isinf.c
--- a/lib/libc/arch/arm32/gen/isinf.c   Sun Aug 29 17:57:25 1999 +0000
+++ b/lib/libc/arch/arm32/gen/isinf.c   Sun Aug 29 18:08:27 1999 +0000
@@ -1,7 +1,12 @@
-/*     $NetBSD: isinf.c,v 1.5 1998/11/14 19:31:01 christos Exp $       */
+/*     $NetBSD: isinf.c,v 1.6 1999/08/29 18:08:29 mycroft Exp $        */
 
 /*
- * Copyright (c) 1996 Mark Brinicombe
+ * 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
@@ -13,16 +18,16 @@
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
- *     This product includes software developed by Mark Brinicombe
- *     for the NetBSD project.
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
@@ -30,32 +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    8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: isinf.c,v 1.6 1999/08/29 18:08:29 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 ieee_double *p = (struct ieee_double *)(void *)&d;
-
-       return(p->dbl_exp == DBL_EXP_INFNAN && (p->dbl_frach || p->dbl_fracl));
-}
-
-int
 isinf(d)
        double d;
 {
        register struct ieee_double *p = (struct ieee_double *)(void *)&d;
 
-       return(p->dbl_exp == DBL_EXP_INFNAN && !p->dbl_frach && !p->dbl_fracl);
+       return (p->dbl_exp == DBL_EXP_INFNAN &&
+           (p->dbl_frach == 0 && p->dbl_fracl == 0));
 }
diff -r c9d390a40277 -r 02944b153531 lib/libc/arch/arm32/gen/isnan.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/arm32/gen/isnan.c   Sun Aug 29 18:08:27 1999 +0000
@@ -0,0 +1,68 @@
+/*     $NetBSD: isnan.c,v 1.1 1999/08/29 18:08:29 mycroft Exp $        */
+
+/*
+ * Copyright (c) 1992, 1993
+ *     The Regents of the University of California.  All rights reserved.



Home | Main Index | Thread Index | Old Index