Commit fd51f229 authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Reimplement _fpclass().

parent 23008a0f
......@@ -17728,7 +17728,6 @@ for ac_func in \
finitef \
fnmatch \
fork \
fpclass \
fstatfs \
fstatvfs \
futimens \
......
......@@ -2167,7 +2167,6 @@ AC_CHECK_FUNCS(\
finitef \
fnmatch \
fork \
fpclass \
fstatfs \
fstatvfs \
futimens \
......
......@@ -79,7 +79,7 @@
@ cdecl _finite(double) ucrtbase._finite
@ cdecl -arch=!i386 _finitef(float) ucrtbase._finitef
@ cdecl _fpclass(double) ucrtbase._fpclass
@ stub _fpclassf
@ cdecl -arch=!i386 _fpclassf(float) ucrtbase._fpclassf
@ cdecl -arch=i386 -ret64 _ftol() ucrtbase._ftol
@ cdecl -arch=win64 _get_FMA3_enable() ucrtbase._get_FMA3_enable
@ cdecl _hypot(double double) ucrtbase._hypot
......
......@@ -282,7 +282,7 @@
@ cdecl _o__findnext64i32(long ptr) ucrtbase._o__findnext64i32
@ cdecl _o__flushall() ucrtbase._o__flushall
@ cdecl _o__fpclass(double) ucrtbase._o__fpclass
@ stub _o__fpclassf
@ cdecl -arch=!i386 _o__fpclassf(float) ucrtbase._o__fpclassf
@ cdecl _o__fputc_nolock(long ptr) ucrtbase._o__fputc_nolock
@ cdecl _o__fputchar(long) ucrtbase._o__fputchar
@ cdecl _o__fputwc_nolock(long ptr) ucrtbase._o__fputwc_nolock
......
......@@ -824,7 +824,7 @@
@ cdecl _flushall() MSVCRT__flushall
@ extern _fmode MSVCRT__fmode
@ cdecl _fpclass(double) MSVCRT__fpclass
# stub -arch=x86_64 _fpclassf
@ cdecl -arch=!i386 _fpclassf(float) MSVCRT__fpclassf
@ cdecl -arch=i386,x86_64,arm,arm64 _fpieee_flt(long ptr ptr)
@ cdecl _fpreset()
@ stub _fprintf_l
......
......@@ -1171,7 +1171,7 @@
@ cdecl _flushall() MSVCRT__flushall
@ extern _fmode MSVCRT__fmode
@ cdecl _fpclass(double) MSVCRT__fpclass
# stub -arch=x86_64 _fpclassf
@ cdecl -arch=!i386 _fpclassf(float) MSVCRT__fpclassf
@ cdecl -arch=i386,x86_64,arm,arm64 _fpieee_flt(long ptr ptr)
@ cdecl _fpreset()
@ stub _fprintf_l
......
......@@ -1171,7 +1171,7 @@
@ cdecl _flushall() MSVCRT__flushall
@ extern _fmode MSVCRT__fmode
@ cdecl _fpclass(double) MSVCRT__fpclass
# stub -arch=x86_64 _fpclassf
@ cdecl -arch=!i386 _fpclassf(float) MSVCRT__fpclassf
@ cdecl -arch=i386,x86_64,arm,arm64 _fpieee_flt(long ptr ptr)
@ cdecl _fpreset()
@ stub _fprintf_l
......
......@@ -1099,7 +1099,7 @@
@ cdecl _flushall() msvcr120._flushall
@ extern _fmode msvcr120._fmode
@ cdecl _fpclass(double) msvcr120._fpclass
# stub -arch=x86_64 _fpclassf
@ cdecl -arch=!i386 _fpclassf(float) msvcr120._fpclassf
@ cdecl -arch=i386,x86_64,arm,arm64 _fpieee_flt(long ptr ptr) msvcr120._fpieee_flt
@ cdecl _fpreset() msvcr120._fpreset
@ stub _fprintf_l
......
......@@ -490,7 +490,7 @@
@ cdecl _flushall() MSVCRT__flushall
@ extern _fmode MSVCRT__fmode
@ cdecl _fpclass(double) MSVCRT__fpclass
# stub -arch=x86_64 _fpclassf
@ cdecl -arch=!i386 _fpclassf(float) MSVCRT__fpclassf
@ cdecl -arch=i386,x86_64,arm,arm64 _fpieee_flt(long ptr ptr)
@ cdecl _fpreset()
@ stub _fprintf_l
......
......@@ -473,7 +473,7 @@
@ cdecl _flushall() MSVCRT__flushall
@ extern _fmode MSVCRT__fmode
@ cdecl _fpclass(double) MSVCRT__fpclass
# stub -arch=win64 _fpclassf(float)
@ cdecl -arch=!i386 _fpclassf(float) MSVCRT__fpclassf
@ cdecl -arch=i386,x86_64,arm,arm64 _fpieee_flt(long ptr ptr)
@ cdecl _fpreset()
@ stub _fprintf_l
......
......@@ -209,6 +209,28 @@ float CDECL MSVCRT__logbf( float num )
#ifndef __i386__
/*********************************************************************
* _fpclassf (MSVCRT.@)
*/
int CDECL MSVCRT__fpclassf( float num )
{
union { float f; UINT32 i; } u = { num };
int e = u.i >> 23 & 0xff;
int s = u.i >> 31;
switch (e)
{
case 0:
if (u.i << 1) return s ? MSVCRT__FPCLASS_ND : MSVCRT__FPCLASS_PD;
return s ? MSVCRT__FPCLASS_NZ : MSVCRT__FPCLASS_PZ;
case 0xff:
if (u.i << 9) return ((u.i >> 22) & 1) ? MSVCRT__FPCLASS_QNAN : MSVCRT__FPCLASS_SNAN;
return s ? MSVCRT__FPCLASS_NINF : MSVCRT__FPCLASS_PINF;
default:
return s ? MSVCRT__FPCLASS_NN : MSVCRT__FPCLASS_PN;
}
}
/*********************************************************************
* _finitef (MSVCRT.@)
*/
int CDECL MSVCRT__finitef( float num )
......@@ -1391,35 +1413,21 @@ __ASM_GLOBAL_FUNC(MSVCRT__ftol,
*/
int CDECL MSVCRT__fpclass(double num)
{
#if defined(HAVE_FPCLASS) || defined(fpclass)
switch (fpclass( num ))
{
case FP_SNAN: return MSVCRT__FPCLASS_SNAN;
case FP_QNAN: return MSVCRT__FPCLASS_QNAN;
case FP_NINF: return MSVCRT__FPCLASS_NINF;
case FP_PINF: return MSVCRT__FPCLASS_PINF;
case FP_NDENORM: return MSVCRT__FPCLASS_ND;
case FP_PDENORM: return MSVCRT__FPCLASS_PD;
case FP_NZERO: return MSVCRT__FPCLASS_NZ;
case FP_PZERO: return MSVCRT__FPCLASS_PZ;
case FP_NNORM: return MSVCRT__FPCLASS_NN;
case FP_PNORM: return MSVCRT__FPCLASS_PN;
default: return MSVCRT__FPCLASS_PN;
}
#elif defined (fpclassify)
switch (fpclassify( num ))
{
case FP_NAN: return MSVCRT__FPCLASS_QNAN;
case FP_INFINITE: return signbit(num) ? MSVCRT__FPCLASS_NINF : MSVCRT__FPCLASS_PINF;
case FP_SUBNORMAL: return signbit(num) ?MSVCRT__FPCLASS_ND : MSVCRT__FPCLASS_PD;
case FP_ZERO: return signbit(num) ? MSVCRT__FPCLASS_NZ : MSVCRT__FPCLASS_PZ;
}
return signbit(num) ? MSVCRT__FPCLASS_NN : MSVCRT__FPCLASS_PN;
#else
if (!isfinite(num))
return MSVCRT__FPCLASS_QNAN;
return num == 0.0 ? MSVCRT__FPCLASS_PZ : (num < 0 ? MSVCRT__FPCLASS_NN : MSVCRT__FPCLASS_PN);
#endif
union { double f; UINT64 i; } u = { num };
int e = u.i >> 52 & 0x7ff;
int s = u.i >> 63;
switch (e)
{
case 0:
if (u.i << 1) return s ? MSVCRT__FPCLASS_ND : MSVCRT__FPCLASS_PD;
return s ? MSVCRT__FPCLASS_NZ : MSVCRT__FPCLASS_PZ;
case 0x7ff:
if (u.i << 12) return ((u.i >> 51) & 1) ? MSVCRT__FPCLASS_QNAN : MSVCRT__FPCLASS_SNAN;
return s ? MSVCRT__FPCLASS_NINF : MSVCRT__FPCLASS_PINF;
default:
return s ? MSVCRT__FPCLASS_NN : MSVCRT__FPCLASS_PN;
}
}
/*********************************************************************
......
......@@ -456,7 +456,7 @@
@ cdecl _flushall() MSVCRT__flushall
@ extern _fmode MSVCRT__fmode
@ cdecl _fpclass(double) MSVCRT__fpclass
# stub -arch=win64 _fpclassf(float)
@ cdecl -arch=!i386 _fpclassf(float) MSVCRT__fpclassf
@ cdecl -arch=i386,x86_64,arm,arm64 _fpieee_flt(long ptr ptr)
@ cdecl _fpreset()
# stub _fprintf_l(ptr str ptr)
......
......@@ -324,7 +324,7 @@
@ cdecl -arch=!i386 _finitef(float) MSVCRT__finitef
@ cdecl _flushall() MSVCRT__flushall
@ cdecl _fpclass(double) MSVCRT__fpclass
@ stub _fpclassf
@ cdecl -arch=!i386 _fpclassf(float) MSVCRT__fpclassf
@ cdecl -arch=i386,x86_64,arm,arm64 _fpieee_flt(long ptr ptr)
@ cdecl _fpreset()
@ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock
......@@ -946,7 +946,7 @@
@ cdecl _o__findnext64i32(long ptr) MSVCRT__findnext64i32
@ cdecl _o__flushall() MSVCRT__flushall
@ cdecl _o__fpclass(double) MSVCRT__fpclass
@ stub _o__fpclassf
@ cdecl -arch=!i386 _o__fpclassf(float) MSVCRT__fpclassf
@ cdecl _o__fputc_nolock(long ptr) MSVCRT__fputc_nolock
@ cdecl _o__fputchar(long) MSVCRT__fputchar
@ cdecl _o__fputwc_nolock(long ptr) MSVCRT__fputwc_nolock
......
......@@ -192,9 +192,6 @@
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
/* Define to 1 if you have the `fpclass' function. */
#undef HAVE_FPCLASS
/* Define if FreeType 2 is installed */
#undef HAVE_FREETYPE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment