75 lines
1.7 KiB
Plaintext
75 lines
1.7 KiB
Plaintext
$NetBSD: patch-ax,v 1.1.1.1 2011/02/16 17:10:41 thomasklausner Exp $
|
|
|
|
--- src/dmd/root/port.c.orig 2010-12-20 20:02:36.000000000 +0000
|
|
+++ src/dmd/root/port.c
|
|
@@ -315,14 +315,14 @@ char *Port::strupr(char *s)
|
|
|
|
#endif
|
|
|
|
-#if linux || __APPLE__ || __FreeBSD__
|
|
+#if linux || __APPLE__ || __FreeBSD__ || __NetBSD__
|
|
|
|
#include <math.h>
|
|
#if linux
|
|
#include <bits/nan.h>
|
|
#include <bits/mathdef.h>
|
|
#endif
|
|
-#if __FreeBSD__ && __i386__
|
|
+#if (__FreeBSD__ || __NetBSD__) && (__i386__ || __amd64__)
|
|
#include <ieeefp.h>
|
|
#endif
|
|
#include <time.h>
|
|
@@ -358,23 +358,25 @@ PortInitializer::PortInitializer()
|
|
foo = -foo; // turn off sign bit
|
|
Port::nan = foo;
|
|
|
|
-#if __FreeBSD__ && __i386__
|
|
+#if (__FreeBSD__ || __NetBSD__) && (__i386__ || __amd64__)
|
|
// LDBL_MAX comes out as infinity. Fix.
|
|
static unsigned char x[sizeof(long double)] =
|
|
{ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x7F };
|
|
Port::ldbl_max = *(long double *)&x[0];
|
|
// FreeBSD defaults to double precision. Switch to extended precision.
|
|
+/* XXX: does not exist on NetBSD */
|
|
+#if (__FreeBSD__) && __i386__
|
|
fpsetprec(FP_PE);
|
|
#endif
|
|
+#endif
|
|
}
|
|
|
|
-#undef isnan
|
|
int Port::isNan(double r)
|
|
{
|
|
#if __APPLE__
|
|
return __inline_isnan(r);
|
|
#else
|
|
- return ::isnan(r);
|
|
+ return isnan(r);
|
|
#endif
|
|
}
|
|
|
|
@@ -383,7 +385,7 @@ int Port::isNan(long double r)
|
|
#if __APPLE__
|
|
return __inline_isnan(r);
|
|
#else
|
|
- return ::isnan(r);
|
|
+ return isnan(r);
|
|
#endif
|
|
}
|
|
|
|
@@ -409,13 +411,12 @@ int Port::isFinite(double r)
|
|
return ::finite(r);
|
|
}
|
|
|
|
-#undef isinf
|
|
int Port::isInfinity(double r)
|
|
{
|
|
#if __APPLE__
|
|
return fpclassify(r) == FP_INFINITE;
|
|
#else
|
|
- return ::isinf(r);
|
|
+ return isinf(r);
|
|
#endif
|
|
}
|
|
|