libm,6809: add a helper set for the double ops we can't inline
authorAlan Cox <alan@linux.intel.com>
Sun, 25 Feb 2018 18:46:33 +0000 (18:46 +0000)
committerAlan Cox <alan@linux.intel.com>
Sun, 25 Feb 2018 18:46:33 +0000 (18:46 +0000)
Library/libs/Makefile.6809
Library/libs/mathhelper.c [new file with mode: 0644]

index 05a3357..2129dcc 100644 (file)
@@ -80,6 +80,7 @@ SRC_LM += sinf.c sincosf.c sinhf.c
 SRC_LM += sqrtf.c tgammaf.c
 SRC_LM += vfscanf_m.c vfprintf_m.c
 SRC_LM += __expo2f.c __float_bits.c __fpclassifyf.c __log1pf.c __signgam.c
+SRC_LM += mathhelper.c
 
 
 OBJ_C = $(SRC_C:.c=.o)
diff --git a/Library/libs/mathhelper.c b/Library/libs/mathhelper.c
new file mode 100644 (file)
index 0000000..0461574
--- /dev/null
@@ -0,0 +1,51 @@
+#include "libm.h"
+
+#if defined(NO_64BIT) && !defined(double)
+
+/* Not tested these yet */
+
+int __isinf(double x){
+    uint32_t hi;
+    GET_HIGH_WORD(hi, x);
+    hi &= 0x7FFFFFFFUL;
+    if (hi == (0x7FFUL << 20))
+        return 1;
+    return 0;
+}
+
+int __isnan(double x){
+    uint32_t hi;
+    GET_HIGH_WORD(hi, x);
+    hi &= 0x7FFFFFFFUL;
+    if (hi > (0x7FFUL << 20))
+        return 1;
+    return 0;
+}
+
+int __isnormal(double x){
+    uint32_t hi;
+    GET_HIGH_WORD(hi, x);
+    hi += (1UL << 20);
+    hi &= 0x7FFFFFFFUL;
+    if (hi >= (1UL << 21))
+        return 1;
+    return 0;
+}
+
+int __isfinite(double x){
+    uint32_t hi;
+    GET_HIGH_WORD(hi, x);
+    hi &= 0x7FFFFFFFUL;
+    if (hi < (0x7FFUL << 20))
+        return 1;
+    return 0;
+}
+
+int __signbit(double x) {
+    uint32_t hi;
+    GET_HIGH_WORD(hi, x);
+    return hi >> 31;
+}
+
+
+#endif