summaryrefslogtreecommitdiffstats
path: root/modules/fdlibm/patches/22_add_float_types.patch
diff options
context:
space:
mode:
Diffstat (limited to 'modules/fdlibm/patches/22_add_float_types.patch')
-rw-r--r--modules/fdlibm/patches/22_add_float_types.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/modules/fdlibm/patches/22_add_float_types.patch b/modules/fdlibm/patches/22_add_float_types.patch
new file mode 100644
index 0000000000..39b991a486
--- /dev/null
+++ b/modules/fdlibm/patches/22_add_float_types.patch
@@ -0,0 +1,66 @@
+diff --git a/math_private.h b/math_private.h
+--- a/math_private.h
++++ b/math_private.h
+@@ -27,16 +27,17 @@
+
+ /*
+ * Emulate FreeBSD internal double types.
+ * Adapted from https://github.com/freebsd/freebsd-src/search?q=__double_t
+ */
+
+ typedef double __double_t;
+ typedef __double_t double_t;
++typedef float __float_t;
+
+ /*
+ * The original fdlibm code used statements like:
+ * n0 = ((*(int*)&one)>>29)^1; * index of high word *
+ * ix0 = *(n0+(int*)&x); * high word of x *
+ * ix1 = *((1-n0)+(int*)&x); * low word of x *
+ * to dig two 32 bit words out of the 64 bit IEEE floating point
+ * value. That is non-ANSI, and, moreover, the gcc instruction
+diff --git a/e_rem_pio2f.cpp b/e_rem_pio2f.cpp
+--- a/e_rem_pio2f.cpp
++++ b/e_rem_pio2f.cpp
+@@ -49,17 +49,17 @@ int
+ double tx[1],ty[1];
+ float z;
+ int32_t e0,n,ix,hx;
+
+ GET_FLOAT_WORD(hx,x);
+ ix = hx&0x7fffffff;
+ /* 33+53 bit pi is good enough for medium size */
+ if(ix<0x4dc90fdb) { /* |x| ~< 2^28*(pi/2), medium size */
+- fn = rnint((float_t)x*invpio2);
++ fn = rnint((float)x*invpio2);
+ n = irint(fn);
+ r = x-fn*pio2_1;
+ w = fn*pio2_1t;
+ *y = r-w;
+ return n;
+ }
+ /*
+ * all other (large) arguments
+diff --git a/s_scalbnf.cpp b/s_scalbnf.cpp
+--- a/s_scalbnf.cpp
++++ b/s_scalbnf.cpp
+@@ -7,18 +7,18 @@
+ * for all contributors to musl.
+ */
+ #include <stdint.h>
+
+ #include "math_private.h"
+
+ float scalbnf(float x, int n)
+ {
+ union {float f; uint32_t i;} u;
+- float_t y = x;
++ float y = x;
+
+ if (n > 127) {
+ y *= 0x1p127f;
+ n -= 127;
+ if (n > 127) {
+ y *= 0x1p127f;
+ n -= 127;
+ if (n > 127)