mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 11:31:40 +00:00
[INCLUDE/CRT]
Partly revert r56995. Firstly it breaks MSVC builds, secondly the stuff doesn't belong into this header. MS headers don't have __fpclassify etc and our headers are not supposed to contain any fancy additions. If you need it for 3rd party code, put it somewhere else. svn path=/trunk/; revision=57012
This commit is contained in:
parent
b3b73888b1
commit
716b77c63e
1 changed files with 10 additions and 108 deletions
|
@ -240,6 +240,8 @@ extern "C++" {
|
|||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif /* !_INC_MATH */
|
||||
|
||||
#if defined(_USE_MATH_DEFINES) && !defined(_MATH_DEFINES_DEFINED)
|
||||
#define _MATH_DEFINES_DEFINED
|
||||
|
||||
|
@ -259,141 +261,41 @@ extern "C++" {
|
|||
|
||||
#endif /* _USE_MATH_DEFINES */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef __NO_ISOCEXT
|
||||
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
|
||||
|| !defined __STRICT_ANSI__ || defined __GLIBCPP__
|
||||
|
||||
/* 7.12.3.1 */
|
||||
/*
|
||||
Return values for fpclassify.
|
||||
These are based on Intel x87 fpu condition codes
|
||||
in the high byte of status word and differ from
|
||||
the return values for MS IEEE 754 extension _fpclass()
|
||||
*/
|
||||
#define FP_NAN 0x0100
|
||||
#define FP_NORMAL 0x0400
|
||||
#define FP_INFINITE (FP_NAN | FP_NORMAL)
|
||||
#define FP_ZERO 0x4000
|
||||
#define FP_SUBNORMAL (FP_NORMAL | FP_ZERO)
|
||||
/* 0x0200 is signbit mask */
|
||||
|
||||
/*
|
||||
We can't inline float or double, because we want to ensure truncation
|
||||
to semantic type before classification.
|
||||
(A normal long double value might become subnormal when
|
||||
converted to double, and zero when converted to float.)
|
||||
*/
|
||||
|
||||
extern int __cdecl __fpclassifyl (long double);
|
||||
extern int __cdecl __fpclassifyf (float);
|
||||
extern int __cdecl __fpclassify (double);
|
||||
|
||||
#ifndef __CRT__NO_INLINE
|
||||
__CRT_INLINE int __cdecl __fpclassifyl (long double x) {
|
||||
unsigned short sw;
|
||||
__asm__ __volatile__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x));
|
||||
return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
|
||||
}
|
||||
__CRT_INLINE int __cdecl __fpclassify (double x) {
|
||||
#ifdef __x86_64__
|
||||
__mingw_dbl_type_t hlp;
|
||||
unsigned int l, h;
|
||||
|
||||
hlp.x = x;
|
||||
h = hlp.lh.high;
|
||||
l = hlp.lh.low | (h & 0xfffff);
|
||||
h &= 0x7ff00000;
|
||||
if ((h | l) == 0)
|
||||
return FP_ZERO;
|
||||
if (!h)
|
||||
return FP_SUBNORMAL;
|
||||
if (h == 0x7ff00000)
|
||||
return (l ? FP_NAN : FP_INFINITE);
|
||||
return FP_NORMAL;
|
||||
#else
|
||||
unsigned short sw;
|
||||
__asm__ __volatile__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x));
|
||||
return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
|
||||
#endif
|
||||
}
|
||||
__CRT_INLINE int __cdecl __fpclassifyf (float x) {
|
||||
#ifdef __x86_64__
|
||||
__mingw_flt_type_t hlp;
|
||||
|
||||
hlp.x = x;
|
||||
hlp.val &= 0x7fffffff;
|
||||
if (hlp.val == 0)
|
||||
return FP_ZERO;
|
||||
if (hlp.val < 0x800000)
|
||||
return FP_SUBNORMAL;
|
||||
if (hlp.val >= 0x7f800000)
|
||||
return (hlp.val > 0x7f800000 ? FP_NAN : FP_INFINITE);
|
||||
return FP_NORMAL;
|
||||
#else
|
||||
unsigned short sw;
|
||||
__asm__ __volatile__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x));
|
||||
return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x) \
|
||||
: sizeof (x) == sizeof (double) ? __fpclassify (x) \
|
||||
: __fpclassifyl (x))
|
||||
|
||||
/* 7.12.3.2 */
|
||||
#define isfinite(x) ((fpclassify(x) & FP_NAN) == 0)
|
||||
|
||||
/* 7.12.3.3 */
|
||||
#define isinf(x) (fpclassify(x) == FP_INFINITE)
|
||||
|
||||
/* Inverse hyperbolic trig functions */
|
||||
/* 7.12.5.1 */
|
||||
/* Inverse hyperbolic trig functions */
|
||||
/* 7.12.5.1 */
|
||||
extern double __cdecl acosh (double);
|
||||
extern float __cdecl acoshf (float);
|
||||
extern long double __cdecl acoshl (long double);
|
||||
|
||||
/* 7.12.5.2 */
|
||||
/* 7.12.5.2 */
|
||||
extern double __cdecl asinh (double);
|
||||
extern float __cdecl asinhf (float);
|
||||
extern long double __cdecl asinhl (long double);
|
||||
|
||||
/* 7.12.5.3 */
|
||||
/* 7.12.5.3 */
|
||||
extern double __cdecl atanh (double);
|
||||
extern float __cdecl atanhf (float);
|
||||
extern long double __cdecl atanhl (long double);
|
||||
|
||||
/* 7.12.6.2 */
|
||||
/* 7.12.6.2 */
|
||||
extern double __cdecl exp2(double);
|
||||
extern float __cdecl exp2f(float);
|
||||
extern long double __cdecl exp2l(long double);
|
||||
|
||||
/* 7.12.6.10 */
|
||||
/* 7.12.6.10 */
|
||||
extern double __cdecl log2 (double);
|
||||
extern float __cdecl log2f (float);
|
||||
extern long double __cdecl log2l (long double);
|
||||
|
||||
/* 7.12.9.6 */
|
||||
/* round away from zero, regardless of fpu control word settings */
|
||||
extern double __cdecl round (double);
|
||||
extern float __cdecl roundf (float);
|
||||
extern long double __cdecl roundl (long double);
|
||||
|
||||
/* 7.12.9.8 */
|
||||
/* round towards zero, regardless of fpu control word settings */
|
||||
/* 7.12.9.8 */
|
||||
/* round towards zero, regardless of fpu control word settings */
|
||||
extern double __cdecl trunc (double);
|
||||
extern float __cdecl truncf (float);
|
||||
extern long double __cdecl truncl (long double);
|
||||
|
||||
#endif /* __STDC_VERSION__ >= 199901L */
|
||||
#endif /* __NO_ISOCEXT */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* !_INC_MATH */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue