Blame sysdeps/i386/fpu/s_isnanl.c

Packit 6c4009
/* s_isnanl.c -- long double version for i387 of s_isnan.c.
Packit 6c4009
 * Conversion to long double by Ulrich Drepper,
Packit 6c4009
 * Cygnus Support, drepper@cygnus.com.
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * ====================================================
Packit 6c4009
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
Packit 6c4009
 *
Packit 6c4009
 * Developed at SunPro, a Sun Microsystems, Inc. business.
Packit 6c4009
 * Permission to use, copy, modify, and distribute this
Packit 6c4009
 * software is freely granted, provided that this notice
Packit 6c4009
 * is preserved.
Packit 6c4009
 * ====================================================
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
 * isnanl(x) returns 1 is x is nan, 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 __isnanl(long double x)
Packit 6c4009
{
Packit 6c4009
	int32_t se,hx,lx;
Packit 6c4009
	GET_LDOUBLE_WORDS(se,hx,lx,x);
Packit 6c4009
	se = (se & 0x7fff) << 1;
Packit 6c4009
	/* The additional & 0x7fffffff is required because Intel's
Packit 6c4009
	   extended format has the normally implicit 1 explicit
Packit 6c4009
	   present.  Sigh!  */
Packit 6c4009
	lx |= hx & 0x7fffffff;
Packit 6c4009
	se |= (uint32_t)(lx|(-lx))>>31;
Packit 6c4009
	se = 0xfffe - se;
Packit 6c4009
	return (int)((uint32_t)(se))>>16;
Packit 6c4009
}
Packit 6c4009
hidden_def (__isnanl)
Packit 6c4009
weak_alias (__isnanl, isnanl)