Steal MSL stuff from sms and fdlibm

This commit is contained in:
Roman Sandu
2025-06-23 20:33:40 +03:00
parent a10e202517
commit bf33740d76
59 changed files with 4782 additions and 220 deletions
+40 -20
View File
@@ -19,19 +19,19 @@ extern "C" {
/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly
but these catch some common cases. */
#if defined(i386) || defined(i486) || defined(intel) || defined(x86) \
|| defined(i86pc) || defined(__alpha) || defined(__osf__)
#if defined(i386) || defined(i486) || defined(intel) || defined(x86) || defined(i86pc) || defined(__alpha) || \
defined(__osf__)
#define __LITTLE_ENDIAN
#endif
#ifdef __LITTLE_ENDIAN
#define __HI(x) *(1 + (int*)&x)
#define __LO(x) *(int*)&x
#define __HI(x) *(1 + (int*)&x)
#define __LO(x) *(int*)&x
#define __HIp(x) *(1 + (int*)x)
#define __LOp(x) *(int*)x
#else
#define __HI(x) *(int*)&x
#define __LO(x) *(1 + (int*)&x)
#define __HI(x) *(int*)&x
#define __LO(x) *(1 + (int*)&x)
#define __HIp(x) *(int*)x
#define __LOp(x) *(1 + (int*)x)
#endif
@@ -57,7 +57,7 @@ extern int signgam;
enum fdversion { fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix };
#define _LIB_VERSION_TYPE enum fdversion
#define _LIB_VERSION _fdlib_version
#define _LIB_VERSION _fdlib_version
/* if global variable _LIB_VERSION is not desirable, one may
* change the following to be a constant by:
@@ -68,17 +68,17 @@ enum fdversion { fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix };
*/
extern _LIB_VERSION_TYPE _LIB_VERSION;
#define _IEEE_ fdlibm_ieee
#define _SVID_ fdlibm_svid
#define _IEEE_ fdlibm_ieee
#define _SVID_ fdlibm_svid
#define _XOPEN_ fdlibm_xopen
#define _POSIX_ fdlibm_posix
struct exception {
int type;
char* name;
double arg1;
double arg2;
double retval;
int type;
char* name;
double arg1;
double arg2;
double retval;
};
#define HUGE MAXFLOAT
@@ -90,12 +90,12 @@ struct exception {
#define X_TLOSS 1.41484755040568800000e+16
#define DOMAIN 1
#define SING 2
#define OVERFLOW 3
#define DOMAIN 1
#define SING 2
#define OVERFLOW 3
#define UNDERFLOW 4
#define TLOSS 5
#define PLOSS 6
#define TLOSS 5
#define PLOSS 6
/**
* ANSI/POSIX
@@ -227,8 +227,28 @@ extern double __kernel_cos __P((double, double));
extern double __kernel_tan __P((double, double, int));
extern int __kernel_rem_pio2 __P((double*, double*, int, int, int, const int*));
// Dirty hack to avoid the current header mess
#ifndef FABS_DECLARED
#define FABS_DECLARED
inline double fabs(double x) {
return __fabs(x);
}
#endif
extern unsigned long __float_nan[];
extern unsigned long __float_huge[];
#ifndef INFINITY
#define INFINITY (*(float*)__float_huge)
#endif
#ifndef NAN
#define NAN (*(float*)__float_nan)
#endif
#ifndef HUGE_VALF
#define HUGE_VALF (*(float*)__float_huge)
#endif
#ifdef __cplusplus
};
#endif // ifdef __cplusplus
#endif
#endif