1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/libm/src/isinf.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,85 @@
1.4 +/*--------------------------------------------------------------------
1.5 + *© Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
1.6 + *--------------------------------------------------------------------
1.7 +*/
1.8 +/*-
1.9 + * Copyright (c) 2004 David Schultz <das@FreeBSD.ORG>
1.10 + * All rights reserved.
1.11 + *
1.12 + * Redistribution and use in source and binary forms, with or without
1.13 + * modification, are permitted provided that the following conditions
1.14 + * are met:
1.15 + * 1. Redistributions of source code must retain the above copyright
1.16 + * notice, this list of conditions and the following disclaimer.
1.17 + * 2. Redistributions in binary form must reproduce the above copyright
1.18 + * notice, this list of conditions and the following disclaimer in the
1.19 + * documentation and/or other materials provided with the distribution.
1.20 + *
1.21 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1.22 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.23 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.24 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1.25 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.26 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.27 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.28 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.29 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.30 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.31 + * SUCH DAMAGE.
1.32 + *
1.33 + * $FreeBSD: src/lib/libc/gen/isinf.c,v 1.2 2004/07/10 15:52:26 marcel Exp $
1.34 + */
1.35 +
1.36 +#include <math.h>
1.37 +
1.38 +#include "fpmath.h"
1.39 +
1.40 +/*
1.41 + * XXX These routines belong in libm, but they must remain in libc for
1.42 + * binary compat until we can bump libm's major version number.
1.43 + */
1.44 +
1.45 +#ifndef __SYMBIAN32__
1.46 +__weak_reference(__isinf, isinf);
1.47 +#endif //__SYMBIAN32__
1.48 +
1.49 +EXPORT_C int __isinf(double d)
1.50 +{
1.51 + union IEEEd2bits u;
1.52 +
1.53 + u.d = d;
1.54 + #ifdef __SYMBIAN32__
1.55 + return (u.bits.sign) ? (-1)*(u.bits.exp == 2047 && u.bits.manl == 0 && u.bits.manh == 0):
1.56 + (u.bits.exp == 2047 && u.bits.manl == 0 && u.bits.manh == 0);
1.57 + #else
1.58 + return (u.bits.exp == 2047 && u.bits.manl == 0 && u.bits.manh == 0);
1.59 + #endif //__SYMBIAN32__
1.60 +}
1.61 +
1.62 +
1.63 +EXPORT_C int __isinff(float f)
1.64 +{
1.65 + union IEEEf2bits u;
1.66 +
1.67 + u.f = f;
1.68 + #ifdef __SYMBIAN32__
1.69 + return (u.bits.sign) ? (-1)*(u.bits.exp == 255 && u.bits.man == 0):
1.70 + (u.bits.exp == 255 && u.bits.man == 0) ;
1.71 + #else
1.72 + return (u.bits.exp == 255 && u.bits.man == 0);
1.73 + #endif //__SYMBIAN32__
1.74 +}
1.75 +
1.76 +
1.77 +EXPORT_C int __isinfl(long double e)
1.78 +{
1.79 + union IEEEl2bits u;
1.80 +
1.81 + u.e = e;
1.82 + mask_nbit_l(u);
1.83 +#ifndef __alpha__
1.84 + return (u.bits.exp == 32767 && u.bits.manl == 0 && u.bits.manh == 0);
1.85 +#else
1.86 + return (u.bits.exp == 2047 && u.bits.manl == 0 && u.bits.manh == 0);
1.87 +#endif
1.88 +}