Fix6
This commit is contained in:
@@ -11,15 +11,31 @@
|
|||||||
* isnan(x) returns 1 is x is nan, else 0;
|
* isnan(x) returns 1 is x is nan, else 0;
|
||||||
* no branching!
|
* 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);
|
lx = 0x7f800000 - (lx & 0x7fffffff);
|
||||||
return (int) (((unsigned long) lx) >> 31);
|
return (int) (((unsigned long) lx) >> 31);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For PIC32, double is the same as float.
|
* For PIC32, double is the same as float.
|
||||||
*/
|
*/
|
||||||
int isnan (double x) __attribute__((alias ("isnanf")));
|
//int isnan (double x) __attribute__((alias ("isnanf")));
|
||||||
|
|||||||
Reference in New Issue
Block a user