diff --git a/ddmd/root/port.d b/ddmd/root/port.d index 944681fb29..dff213d3be 100644 --- a/ddmd/root/port.d +++ b/ddmd/root/port.d @@ -84,20 +84,6 @@ extern (C++) struct Port static __gshared bool yl2xp1_supported = false; } static __gshared real snan; - static this() - { - /* - * Use a payload which is different from the machine NaN, - * so that uninitialised variables can be - * detected even if exceptions are disabled. - */ - ushort* us = cast(ushort*)&snan; - us[0] = 0; - us[1] = 0; - us[2] = 0; - us[3] = 0xA000; - us[4] = 0x7FFF; - } static bool isNan(double r) { @@ -114,9 +100,11 @@ extern (C++) struct Port return a % b; } - static real fequal(real a, real b) + static bool fequal(real a, real b) { - return memcmp(&a, &b, 10) == 0; + // don't compare pad bytes in extended precision + enum sz = (real.mant_dig == 64) ? 10 : real.sizeof; + return memcmp(&a, &b, sz) == 0; } static int memicmp(const char* s1, const char* s2, size_t n)