diff --git a/src/misc/missing_math.c b/src/misc/missing_math.c index 096e0c780..f07378ae6 100644 --- a/src/misc/missing_math.c +++ b/src/misc/missing_math.c @@ -96,3 +96,53 @@ erfc(double x) return(z); } #endif + + + +#ifndef HAVE_ISNAN +// isnan (originally) for SOI devices in MINGW32 hvogt (dev.c) + +union ieee754_double +{ + double d; + + /* This is the IEEE 754 double-precision format. */ + struct + { + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; + } ieee; + struct + { + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; + } ieee_nan; +}; + +int +isnan(double value) + +{ + union ieee754_double u; + + u.d = value; + + /* IEEE 754 NaN's have the maximum possible + exponent and a nonzero mantissa. */ + return ((u.ieee.exponent & 0x7ff) == 0x7ff && + (u.ieee.mantissa0 != 0 || u.ieee.mantissa1 != 0)); + +} + +/* + * end isnan.c + */ +#endif /* HAVE_ISNAN */ + diff --git a/src/misc/missing_math.h b/src/misc/missing_math.h index 49cf65160..cd8e03a72 100644 --- a/src/misc/missing_math.h +++ b/src/misc/missing_math.h @@ -17,7 +17,11 @@ double logb(double); #ifndef HAVE_SCALB # ifndef HAVE_SCALBN double scalb(double, int); -#endif +# endif #endif -#endif +#ifndef HAVE_ISNAN +int isnan(double value); +#endif /* HAVE_ISNAN */ + +#endif /* MISSING_MATH_H_INCLUDED */ diff --git a/src/spicelib/devices/dev.c b/src/spicelib/devices/dev.c index a80d7025a..3d6f6a2d1 100644 --- a/src/spicelib/devices/dev.c +++ b/src/spicelib/devices/dev.c @@ -413,7 +413,7 @@ extern struct coreInfo_t coreInfo; int load_opus(char *name){ void *lib; - char *msg; + const char *msg; int *num=NULL; struct coreInfo_t **core; SPICEdev **devs; @@ -488,55 +488,3 @@ int load_opus(char *name){ #endif /*-------------------- end of XSPICE additions ----------------------*/ - - -#ifdef __MINGW32__ -// isnan for SOI devices in MINGW32 hvogt - -union ieee754_double - { - double d; - - /* This is the IEEE 754 double-precision format. */ - struct - { - /* Together these comprise the mantissa. */ - unsigned int mantissa1:32; - unsigned int mantissa0:20; - unsigned int exponent:11; - unsigned int negative:1; - } ieee; - struct - { - /* Together these conprise the mantissa. */ - unsigned int mantissa1:32; - unsigned int mantissa0:19; - unsigned int quiet_nan:1; - unsigned int exponent:11; - unsigned int negative:1; - } ieee_nan; - }; - - -#ifndef HAVE_ISNAN -int -isnan(double value) - -{ - union ieee754_double u; - - u.d = value; - - /* IEEE 754 NaN's have the maximum possible - exponent and a nonzero mantissa. */ - return ((u.ieee.exponent & 0x7ff) == 0x7ff && - (u.ieee.mantissa0 != 0 || u.ieee.mantissa1 != 0)); - -} - -/* - * end isnan.c - */ -#endif /* HAVE_ISNAN */ - -#endif