Blame sysdeps/i386/fpu/s_isinfl.c
|
Packit |
6c4009 |
/*
|
|
Packit |
6c4009 |
* Written by J.T. Conklin <jtc@netbsd.org>.
|
|
Packit |
6c4009 |
* Change for long double by Ulrich Drepper <drepper@cygnus.com>.
|
|
Packit |
6c4009 |
* Intel i387 specific version.
|
|
Packit |
6c4009 |
* Public domain.
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if defined(LIBM_SCCS) && !defined(lint)
|
|
Packit |
6c4009 |
static char rcsid[] = "$NetBSD: $";
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/*
|
|
Packit |
6c4009 |
* isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0;
|
|
Packit |
6c4009 |
* no branching!
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <math.h>
|
|
Packit |
6c4009 |
#include <math_private.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
int __isinfl(long double x)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
int32_t se,hx,lx;
|
|
Packit |
6c4009 |
GET_LDOUBLE_WORDS(se,hx,lx,x);
|
|
Packit |
6c4009 |
/* This additional ^ 0x80000000 is necessary because in Intel's
|
|
Packit |
6c4009 |
internal representation of the implicit one is explicit. */
|
|
Packit |
6c4009 |
lx |= (hx ^ 0x80000000) | ((se & 0x7fff) ^ 0x7fff);
|
|
Packit |
6c4009 |
lx |= -lx;
|
|
Packit |
6c4009 |
se &= 0x8000;
|
|
Packit |
6c4009 |
return ~(lx >> 31) & (1 - (se >> 14));
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
hidden_def (__isinfl)
|
|
Packit |
6c4009 |
weak_alias (__isinfl, isinfl)
|