Fix5
This commit is contained in:
@@ -11,9 +11,25 @@
|
|||||||
* isinff(x) returns 1 is x is inf, -1 if x is -inf, else 0;
|
* isinff(x) returns 1 is x is inf, -1 if x is -inf, else 0;
|
||||||
* no branching!
|
* no branching!
|
||||||
*/
|
*/
|
||||||
int isinff (float x)
|
typedef union {
|
||||||
|
float x;
|
||||||
|
struct {
|
||||||
|
long lxx;
|
||||||
|
};
|
||||||
|
} ival;
|
||||||
|
|
||||||
|
//int isinff (float x)
|
||||||
|
//{
|
||||||
|
// long lx = *(long*) &x;
|
||||||
|
// long v = (lx & 0x7fffffff) ^ 0x7f800000;
|
||||||
|
// return ~((v | -v) >> 31) & (lx >> 30);
|
||||||
|
//}
|
||||||
|
|
||||||
|
int isinff (float xx)
|
||||||
{
|
{
|
||||||
unsigned long lx = *(unsigned long*) &x;
|
ival temp;
|
||||||
|
temp.x = xx;
|
||||||
|
long lx = temp.lxx;
|
||||||
long v = (lx & 0x7fffffff) ^ 0x7f800000;
|
long v = (lx & 0x7fffffff) ^ 0x7f800000;
|
||||||
return ~((v | -v) >> 31) & (lx >> 30);
|
return ~((v | -v) >> 31) & (lx >> 30);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user