diff --git a/src/libc/gen/isnanf.c b/src/libc/gen/isnanf.c index a3eaa52..2b298fe 100644 --- a/src/libc/gen/isnanf.c +++ b/src/libc/gen/isnanf.c @@ -11,15 +11,31 @@ * isnan(x) returns 1 is x is nan, else 0; * no branching! */ -int isnanf (float x) -{ - long lx = *(long*) &x; +typedef union { + float x; + struct { + long lxx; + }; +} ival; + +//int isnanf (float x) +//{ +// long lx = *(long*) &x; +// lx = 0x7f800000 - (lx & 0x7fffffff); +// return (int) (((unsigned long) lx) >> 31); +//} +int isnanf (float xx) { + ival temp; + temp.x = xx; + long lx = temp.lxx; lx = 0x7f800000 - (lx & 0x7fffffff); return (int) (((unsigned long) lx) >> 31); } + + /* * For PIC32, double is the same as float. */ -int isnan (double x) __attribute__((alias ("isnanf"))); +//int isnan (double x) __attribute__((alias ("isnanf")));