Fix #2434 - Add INFINIT/NAN for non-c99 compilers

This commit is contained in:
pancake 2015-04-25 04:22:44 +02:00
parent c2a0949e0e
commit db7dd25920
2 changed files with 15 additions and 4 deletions

View File

@ -81,4 +81,15 @@
#undef B
#define B4(a,b,c,d) ((a<<12)|(b<<8)|(c<<4)|(d))
/* portable non-c99 inf/nan types */
#ifndef INFINITY
#define INFINITY (1.0f/0.0f)
#endif
#ifndef NAN
#define NAN (0.0f/0.0f)
#endif
#endif

View File

@ -1298,13 +1298,13 @@ R_API double r_bin_java_raw_to_double(const ut8* raw, ut64 offset) {
IFDBG eprintf ("Convert Long to Double: %08"PFMT64x"\n", bits);
if (0x7ff0000000000000LL == bits) {
res = INFINITY;
}else if (0xfff0000000000000LL == bits) {
} else if (0xfff0000000000000LL == bits) {
res = -INFINITY;
}else if (0x7ff0000000000001LL <= bits && bits <= 0x7fffffffffffffffLL ) {
} else if (0x7ff0000000000001LL <= bits && bits <= 0x7fffffffffffffffLL) {
res = NAN;
}else if (0xfff0000000000001LL <= bits && bits <= 0xffffffffffffffffLL ) {
} else if (0xfff0000000000001LL <= bits && bits <= 0xffffffffffffffffLL) {
res = NAN;
}else{
} else {
res = s* m* my_pow (2, e-1075);//XXXX TODO Get double to work correctly here
IFDBG eprintf (" High-bytes = %02x %02x %02x %02x\n", raw[0], raw[1], raw[2], raw[3]);
IFDBG eprintf (" Low-bytes = %02x %02x %02x %02x\n", raw[4], raw[5], raw[6], raw[7]);