Signed-off-by: Martin Storsjö <[email protected]>
---
mingw-w64-crt/math/bsd_private_base.h | 101 +++++++++++++++++++++
mingw-w64-crt/math/softmath/bsd_private.h | 72 +--------------
mingw-w64-crt/math/softmath/bsd_privatef.h | 23 +----
3 files changed, 103 insertions(+), 93 deletions(-)
create mode 100644 mingw-w64-crt/math/bsd_private_base.h
diff --git a/mingw-w64-crt/math/bsd_private_base.h
b/mingw-w64-crt/math/bsd_private_base.h
new file mode 100644
index 000000000..f31c75d00
--- /dev/null
+++ b/mingw-w64-crt/math/bsd_private_base.h
@@ -0,0 +1,101 @@
+/*
+* ====================================================
+* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+*
+* Developed at SunPro, a Sun Microsystems, Inc. business.
+* Permission to use, copy, modify, and distribute this
+* software is freely granted, provided that this notice
+* is preserved.
+* ====================================================
+*/
+
+#include <inttypes.h>
+
+typedef unsigned int u_int32_t;
+
+typedef union
+{
+ double value;
+ struct
+ {
+ u_int32_t lsw;
+ u_int32_t msw;
+ } parts;
+} ieee_double_shape_type;
+
+typedef union {
+ float value;
+ u_int32_t word;
+} ieee_float_shape_type;
+
+/* Get two 32 bit ints from a double. */
+
+#define EXTRACT_WORDS(ix0,ix1,d) \
+do { \
+ ieee_double_shape_type ew_u; \
+ ew_u.value = (d); \
+ (ix0) = ew_u.parts.msw; \
+ (ix1) = ew_u.parts.lsw; \
+} while (0)
+
+/* Get the most significant 32 bit int from a double. */
+
+#define GET_HIGH_WORD(i,d) \
+do { \
+ ieee_double_shape_type gh_u; \
+ gh_u.value = (d); \
+ (i) = gh_u.parts.msw; \
+} while (0)
+
+/* Get the less significant 32 bit int from a double. */
+
+#define GET_LOW_WORD(i,d) \
+do { \
+ ieee_double_shape_type gl_u; \
+ gl_u.value = (d); \
+ (i) = gl_u.parts.lsw; \
+} while (0)
+
+/* Set a double from two 32 bit ints. */
+
+#define INSERT_WORDS(d,ix0,ix1) \
+do { \
+ ieee_double_shape_type iw_u; \
+ iw_u.parts.msw = (ix0); \
+ iw_u.parts.lsw = (ix1); \
+ (d) = iw_u.value; \
+} while (0)
+
+/* Set the more significant 32 bits of a double from an int. */
+
+#define SET_HIGH_WORD(d,v) \
+do { \
+ ieee_double_shape_type sh_u; \
+ sh_u.value = (d); \
+ sh_u.parts.msw = (v); \
+ (d) = sh_u.value; \
+} while (0)
+
+/* Set the less significant 32 bits of a double from an int. */
+
+#define SET_LOW_WORD(d,v) \
+do { \
+ ieee_double_shape_type sl_u; \
+ sl_u.value = (d); \
+ sl_u.parts.lsw = (v); \
+ (d) = sl_u.value; \
+} while (0)
+
+#define GET_FLOAT_WORD(i,d) do \
+{ \
+ ieee_float_shape_type gf_u; \
+ gf_u.value = (d); \
+ (i) = gf_u.word; \
+} while(0)
+
+#define SET_FLOAT_WORD(d,i) do \
+{ \
+ ieee_float_shape_type gf_u; \
+ gf_u.word = (i); \
+ (d) = gf_u.value; \
+} while(0)
diff --git a/mingw-w64-crt/math/softmath/bsd_private.h
b/mingw-w64-crt/math/softmath/bsd_private.h
index 690214ac6..caccdc7ad 100644
--- a/mingw-w64-crt/math/softmath/bsd_private.h
+++ b/mingw-w64-crt/math/softmath/bsd_private.h
@@ -10,7 +10,7 @@
*/
#include "softmath_private.h"
-#include <inttypes.h>
+#include "../bsd_private_base.h"
static const double
bp[] = {1.0, 1.5,},
@@ -45,73 +45,3 @@ static const double
ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */
ivln2_h= 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b
1/ln2*/
ivln2_l= 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2
tail*/
-
-typedef unsigned int u_int32_t;
-
-typedef union
-{
- double value;
- struct
- {
- u_int32_t lsw;
- u_int32_t msw;
- } parts;
-} ieee_double_shape_type;
-
-/* Get two 32 bit ints from a double. */
-
-#define EXTRACT_WORDS(ix0,ix1,d) \
-do { \
- ieee_double_shape_type ew_u; \
- ew_u.value = (d); \
- (ix0) = ew_u.parts.msw; \
- (ix1) = ew_u.parts.lsw; \
-} while (0)
-
-/* Get the most significant 32 bit int from a double. */
-
-#define GET_HIGH_WORD(i,d) \
-do { \
- ieee_double_shape_type gh_u; \
- gh_u.value = (d); \
- (i) = gh_u.parts.msw; \
-} while (0)
-
-/* Get the less significant 32 bit int from a double. */
-
-#define GET_LOW_WORD(i,d) \
-do { \
- ieee_double_shape_type gl_u; \
- gl_u.value = (d); \
- (i) = gl_u.parts.lsw; \
-} while (0)
-
-/* Set a double from two 32 bit ints. */
-
-#define INSERT_WORDS(d,ix0,ix1) \
-do { \
- ieee_double_shape_type iw_u; \
- iw_u.parts.msw = (ix0); \
- iw_u.parts.lsw = (ix1); \
- (d) = iw_u.value; \
-} while (0)
-
-/* Set the more significant 32 bits of a double from an int. */
-
-#define SET_HIGH_WORD(d,v) \
-do { \
- ieee_double_shape_type sh_u; \
- sh_u.value = (d); \
- sh_u.parts.msw = (v); \
- (d) = sh_u.value; \
-} while (0)
-
-/* Set the less significant 32 bits of a double from an int. */
-
-#define SET_LOW_WORD(d,v) \
-do { \
- ieee_double_shape_type sl_u; \
- sl_u.value = (d); \
- sl_u.parts.lsw = (v); \
- (d) = sl_u.value; \
-} while (0)
diff --git a/mingw-w64-crt/math/softmath/bsd_privatef.h
b/mingw-w64-crt/math/softmath/bsd_privatef.h
index 08ef5880f..466dcf973 100644
--- a/mingw-w64-crt/math/softmath/bsd_privatef.h
+++ b/mingw-w64-crt/math/softmath/bsd_privatef.h
@@ -10,7 +10,7 @@
*/
#include "softmath_private.h"
-#include <inttypes.h>
+#include "../bsd_private_base.h"
static const float
bp[] = {1.0, 1.5,},
@@ -45,24 +45,3 @@ static const float
ivln2 = 1.4426950216e+00, /* 0x3fb8aa3b =1/ln2 */
ivln2_h= 1.4426879883e+00, /* 0x3fb8aa00 =16b 1/ln2*/
ivln2_l= 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
-
-typedef unsigned int u_int32_t;
-
-typedef union {
- float value;
- u_int32_t word;
-} ieee_float_shape_type;
-
-#define GET_FLOAT_WORD(i,d) do \
-{ \
- ieee_float_shape_type gf_u; \
- gf_u.value = (d); \
- (i) = gf_u.word; \
-} while(0)
-
-#define SET_FLOAT_WORD(d,i) do \
-{ \
- ieee_float_shape_type gf_u; \
- gf_u.word = (i); \
- (d) = gf_u.value; \
-} while(0)
--
2.17.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public