Replace s_isnan.c and s_isnanf.c with the more compact s_isnan.c from

libc.  The externally-visible effect of this is to add __isnanl() to
libm, which means that libm.so.2 can once again link against libc.so.4
when LD_BIND_NOW is set.  This was broken by the addition of fdiml(),
which calls __isnanl().
This commit is contained in:
David Schultz 2004-08-05 01:46:11 +00:00
parent 8dc56b6821
commit 2208ce0a06
3 changed files with 55 additions and 69 deletions

View File

@ -84,7 +84,7 @@ COMMON_SRCS= b_exp.c b_log.c b_tgamma.c \
s_expm1.c s_expm1f.c s_fabsf.c s_fdim.c s_finite.c s_finitef.c \
s_floor.c s_floorf.c s_fmax.c s_fmaxf.c s_fmaxl.c s_fmin.c \
s_fminf.c s_fminl.c s_frexp.c s_frexpf.c s_ilogb.c s_ilogbf.c \
s_isfinite.c s_isnanf.c s_isnormal.c s_ldexpf.c \
s_isfinite.c s_isnan.c s_isnormal.c s_ldexpf.c \
s_lib_version.c s_log1p.c \
s_log1pf.c s_logb.c s_logbf.c s_matherr.c s_modff.c \
s_nearbyint.c s_nextafter.c s_nextafterf.c \

View File

@ -1,37 +1,62 @@
/* @(#)s_isnan.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
/*-
* Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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
* 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.
*
* $FreeBSD$
*/
/* For binary compat; to be removed in FreeBSD 6.0. */
#include <math.h>
#ifndef lint
static char rcsid[] = "$FreeBSD$";
#include "fpmath.h"
/* Provided by libc */
#if 0
int
isnan(double d)
{
union IEEEd2bits u;
u.d = d;
return (u.bits.exp == 2047 && (u.bits.manl != 0 || u.bits.manh != 0));
}
#endif
/*
* isnan(x) returns 1 is x is nan, else 0;
* no branching!
*/
#include "math.h"
#include "math_private.h"
#undef isnan
int isnan(double x)
int
isnanf(float f)
{
int32_t hx,lx;
EXTRACT_WORDS(hx,lx,x);
hx &= 0x7fffffff;
hx |= (u_int32_t)(lx|(-lx))>>31;
hx = 0x7ff00000 - hx;
return (int)((u_int32_t)(hx))>>31;
union IEEEf2bits u;
u.f = f;
return (u.bits.exp == 255 && u.bits.man != 0);
}
int
__isnanl(long double e)
{
union IEEEl2bits u;
u.e = e;
mask_nbit_l(u);
return (u.bits.exp == 32767 && (u.bits.manl != 0 || u.bits.manh != 0));
}

View File

@ -1,39 +0,0 @@
/* s_isnanf.c -- float version of s_isnan.c.
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/* For binary compat; to be removed in FreeBSD 6.0. */
#ifndef lint
static char rcsid[] = "$FreeBSD$";
#endif
/*
* isnanf(x) returns 1 is x is nan, else 0;
* no branching!
*/
#include "math.h"
#include "math_private.h"
#undef isnanf
int isnanf(float x)
{
int32_t ix;
GET_FLOAT_WORD(ix,x);
ix &= 0x7fffffff;
ix = 0x7f800000 - ix;
return (int)(((u_int32_t)(ix))>>31);
}