From bcff791a3cafab987804a990d163d42a5ddbeb2e Mon Sep 17 00:00:00 2001 From: igor-m Date: Fri, 11 Apr 2014 22:45:22 +0200 Subject: [PATCH] Fix5 --- src/libc/gen/isinff.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/libc/gen/isinff.c b/src/libc/gen/isinff.c index 6ffac7d..0ad88eb 100644 --- a/src/libc/gen/isinff.c +++ b/src/libc/gen/isinff.c @@ -11,9 +11,25 @@ * isinff(x) returns 1 is x is inf, -1 if x is -inf, else 0; * 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; return ~((v | -v) >> 31) & (lx >> 30); }