mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
(at least for GNUC platforms) don't rely on nasty division-by-zero tricks to generate +-inf and nan. instead borrow the bitlevel twiddling javascript uses. I would imagine that this would work for all platforms that use IEEE floats (which is necessarily all platforms for which EF will work), but someone else needs to figure out if windows will work with this code.
This commit is contained in:
parent
165f9e859f
commit
4182e3c193
@ -79,29 +79,37 @@ union dpun {
|
||||
Flt64 d;
|
||||
};
|
||||
|
||||
union spun {
|
||||
uint32 s;
|
||||
Flt32 f;
|
||||
};
|
||||
|
||||
struct DummyInit
|
||||
{
|
||||
DummyInit() {
|
||||
union dpun u;
|
||||
union dpun du;
|
||||
union spun su;
|
||||
|
||||
#if notyet
|
||||
floatPositiveInfinity = 1.0f/fZero;
|
||||
floatNegativeInfinity = -1.0f/fZero;
|
||||
floatNaN = fZero/fZero;
|
||||
#endif
|
||||
su.s = 0x7f800000;
|
||||
floatPositiveInfinity = su.f;
|
||||
|
||||
u.s.hi = DOUBLE_HI32_EXPMASK;
|
||||
u.s.lo = 0x00000000;
|
||||
doublePositiveInfinity = u.d;
|
||||
du.s.hi = DOUBLE_HI32_EXPMASK;
|
||||
du.s.lo = 0x00000000;
|
||||
doublePositiveInfinity = du.d;
|
||||
|
||||
su.s = 0xff800000;
|
||||
floatNegativeInfinity = su.f;
|
||||
|
||||
u.s.hi = DOUBLE_HI32_SIGNBIT | DOUBLE_HI32_EXPMASK;
|
||||
u.s.lo = 0x00000000;
|
||||
doubleNegativeInfinity = u.d;
|
||||
du.s.hi = DOUBLE_HI32_SIGNBIT | DOUBLE_HI32_EXPMASK;
|
||||
du.s.lo = 0x00000000;
|
||||
doubleNegativeInfinity = du.d;
|
||||
|
||||
su.s = 0x7f900000;
|
||||
floatNaN = su.f;
|
||||
|
||||
u.s.hi = DOUBLE_HI32_EXPMASK | DOUBLE_HI32_MANTMASK;
|
||||
u.s.lo = 0xffffffff;
|
||||
doubleNaN = u.d;
|
||||
du.s.hi = DOUBLE_HI32_EXPMASK | DOUBLE_HI32_MANTMASK;
|
||||
du.s.lo = 0xffffffff;
|
||||
doubleNaN = du.d;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user