crt: arm: Use a bit twiddling implementation of rint*
Split the implementation file per architecture, and use a BSD/Sun
implementation of rint/rintf for arm, as the previous arm
implementation used signed 32 bit integer intermediates.
Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/math/bsd_private_base.h b/mingw-w64-crt/math/bsd_private_base.h
index f31c75d..de5b935 100644
--- a/mingw-w64-crt/math/bsd_private_base.h
+++ b/mingw-w64-crt/math/bsd_private_base.h
@@ -10,6 +10,7 @@
*/
#include <inttypes.h>
+#include <float.h>
typedef unsigned int u_int32_t;
@@ -99,3 +100,24 @@
gf_u.word = (i); \
(d) = gf_u.value; \
} while(0)
+
+
+#ifdef FLT_EVAL_METHOD
+/*
+ * Attempt to get strict C99 semantics for assignment with non-C99 compilers.
+ */
+#if FLT_EVAL_METHOD == 0 || __GNUC__ == 0
+#define STRICT_ASSIGN(type, lval, rval) ((lval) = (rval))
+#else
+#define STRICT_ASSIGN(type, lval, rval) do { \
+ volatile type __lval; \
+ \
+ if (sizeof(type) >= sizeof(long double)) \
+ (lval) = (rval); \
+ else { \
+ __lval = (rval); \
+ (lval) = __lval; \
+ } \
+} while (0)
+#endif
+#endif /* FLT_EVAL_METHOD */