summaryrefslogtreecommitdiffstats
path: root/modules/fdlibm/patches/22_add_float_types.patch
blob: 39b991a4868281f21dcd6e556a239a893dac0ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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)