mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-11 13:26:08 +03:00
Use build host D compiler real type
D needs to compile itself on non-x86 hosts where real type might be something other than 80-bit extended precision. The simplest approach is to use the existing D compiler real type as it must already have correct real.nan and snan intializer. Note this does not work for cross-compiling to alternate targets and is only intended as transitional until that capability is added. Upstream commit: a776514edc914e2e09bd4298fb07f2ac99e86f45
This commit is contained in:
parent
fa8fe51eb6
commit
61bb66bccd
1 changed files with 4 additions and 16 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue