dmd-bootstrap: fix musl

Closes: #1447 [via git-merge-pr]
Signed-off-by: Jürgen Buchmüller <pullmoll@t-online.de>
This commit is contained in:
John 2018-08-03 21:09:34 +02:00 committed by Jürgen Buchmüller
parent da73178cc1
commit 27f3476f33
No known key found for this signature in database
GPG key ID: 6764EC32352D0647
2 changed files with 154 additions and 1 deletions

View file

@ -0,0 +1,152 @@
--- druntime/src/core/stdc/math.d 2018-03-04 08:20:53.000000000 +0100
+++ - 2018-08-03 22:10:15.242825116 +0200
@@ -232,8 +232,148 @@
int isunordered(double x, double y);
int isunordered(real x, real y);
}
+version( CRuntime_Glibc )
+{
+ enum
+ {
+ ///
+ FP_NAN,
+ ///
+ FP_INFINITE,
+ ///
+ FP_ZERO,
+ ///
+ FP_SUBNORMAL,
+ ///
+ FP_NORMAL,
+ }
+
+ enum
+ {
+ ///
+ FP_FAST_FMA = 0,
+ ///
+ FP_FAST_FMAF = 0,
+ ///
+ FP_FAST_FMAL = 0,
+ }
+
+ int __fpclassifyf(float x);
+ int __fpclassify(double x);
+ int __fpclassifyl(real x);
+
+ //int __finitef(float x);
+ //int __finite(double x);
+ //int __finitel(real x);
-version( CRuntime_DigitalMars )
+ //int __isinff(float x);
+ //int __isinf(double x);
+ //int __isinfl(real x);
+
+ //int __isnanf(float x);
+ //int __isnan(double x);
+ //int __isnanl(real x);
+
+ int __signbitf(float x);
+ int __signbit(double x);
+ int __signbitl(real x);
+
+ extern (D)
+ {
+ //int fpclassify(real-floating x);
+ ///
+ int fpclassify(float x) { return __fpclassifyf(x); }
+ ///
+ int fpclassify(double x) { return __fpclassify(x); }
+ ///
+ int fpclassify(real x)
+{
+ return (real.sizeof == double.sizeof)
+ ? __fpclassify(x)
+ : __fpclassifyl(x);
+ }
+ private uint __FLOAT_BITS(float __f)
+ {
+ union __u_t {
+ float __f;
+ uint __i;
+ }
+ __u_t __u;
+ __u.__f = __f;
+ return __u.__i;
+ }
+ private ulong __DOUBLE_BITS(double __f)
+ {
+ union __u_t {
+ double __f;
+ ulong __i;
+ }
+ __u_t __u;
+ __u.__f = __f;
+ return __u.__i;
+ }
+ //int isfinite(real-floating x);
+ ///
+ int isfinite(float x) { return (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000; }
+ ///
+ int isfinite(double x) { return (__DOUBLE_BITS(x) & -1UL>>1) < 0x7ffUL<<52; }
+ ///
+ int isfinite(real x)
+ {
+ return (real.sizeof == double.sizeof)
+ ? isfinite(cast(double)x)
+ : __fpclassifyl(x) > FP_INFINITE;
+ }
+
+ //int isinf(real-floating x);
+ ///
+ int isinf(float x) { return (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000; }
+ ///
+ int isinf(double x) { return (__DOUBLE_BITS(x) & -1UL>>1) == 0x7ffUL<<52; }
+ ///
+ int isinf(real x)
+ {
+ return (real.sizeof == double.sizeof)
+ ? isinf(cast(double)x)
+ : __fpclassifyl(x) == FP_INFINITE;
+ }
+
+ //int isnan(real-floating x);
+ ///
+ int isnan(float x) { return (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000; }
+ ///
+ int isnan(double x) { return (__DOUBLE_BITS(x) & -1UL>>1) > 0x7ffUL<<52; }
+ ///
+ int isnan(real x)
+ {
+ return (real.sizeof == double.sizeof)
+ ? isnan(cast(double)x)
+ : __fpclassifyl(x) == FP_NAN;
+ }
+
+ //int isnormal(real-floating x);
+ ///
+ int isnormal(float x) { return fpclassify(x) == FP_NORMAL; }
+ ///
+ int isnormal(double x) { return fpclassify(x) == FP_NORMAL; }
+ ///
+ int isnormal(real x) { return fpclassify(x) == FP_NORMAL; }
+
+ //int signbit(real-floating x);
+ ///
+ int signbit(float x) { return __signbitf(x); }
+ ///
+ int signbit(double x) { return __signbit(x); }
+ ///
+ int signbit(real x)
+ {
+ return (real.sizeof == double.sizeof)
+ ? __signbit(x)
+ : __signbitl(x);
+ }
+ }
+}
+else version( CRuntime_DigitalMars )
{
enum
{

View file

@ -1,7 +1,7 @@
# Template file for 'dmd-bootstrap'
pkgname=dmd-bootstrap
version=2.069.20180305
revision=1
revision=2
_gitrev_dmd=75266348c8a2368945a339ab86d7c8960a9bfc08
_gitrev_druntime=33ae38cef41564b12864470afaf8430eb7334d3b
_gitrev_phobos=30ac23a0889dd183221ce531a057171dd45296c4
@ -32,6 +32,7 @@ post_extract() {
pre_configure() {
case "$XBPS_TARGET_MACHINE" in
*-musl) patch -p0 < ${FILESDIR}/musl.patch
patch -p0 < ${FILESDIR}/musl-math.patch
esac
}