From: Alan Cox Date: Sun, 25 Feb 2018 18:46:33 +0000 (+0000) Subject: libm,6809: add a helper set for the double ops we can't inline X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=49656764a86ad1cc209587629ce95717767d1e15;p=FUZIX.git libm,6809: add a helper set for the double ops we can't inline --- diff --git a/Library/libs/Makefile.6809 b/Library/libs/Makefile.6809 index 05a33570..2129dcc2 100644 --- a/Library/libs/Makefile.6809 +++ b/Library/libs/Makefile.6809 @@ -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 index 00000000..0461574b --- /dev/null +++ b/Library/libs/mathhelper.c @@ -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