Piotr Caban : include: Fix denormals handling in _fpclassf inline implementation.
Alexandre Julliard
julliard at winehq.org
Fri May 14 15:47:05 CDT 2021
Module: wine
Branch: master
Commit: 522e13e6825f9dd50ddb7ddc079f0abf5dfd1034
URL: https://source.winehq.org/git/wine.git/?a=commit;h=522e13e6825f9dd50ddb7ddc079f0abf5dfd1034
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu May 13 21:15:20 2021 +0200
include: Fix denormals handling in _fpclassf inline implementation.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
include/msvcrt/math.h | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/include/msvcrt/math.h b/include/msvcrt/math.h
index 43e82fc3bea..d2977b67c34 100644
--- a/include/msvcrt/math.h
+++ b/include/msvcrt/math.h
@@ -166,7 +166,20 @@ static inline float fmodf(float x, float y) { return fmod(x, y); }
static inline int _finitef(float x) { return _finite(x); }
static inline int _isnanf(float x) { return _isnan(x); }
-static inline int _fpclassf(float x) { return _fpclass(x); }
+
+static inline int _fpclassf(float x)
+{
+ unsigned int ix = *(int*)&x;
+ double d = x;
+
+ /* construct denormal double */
+ if (!(ix >> 23 & 0xff) && (ix << 1))
+ {
+ unsigned __int64 id = (((unsigned __int64)ix >> 31) << 63) | 1;
+ d = *(double*)&id;
+ }
+ return _fpclass(d);
+}
#endif
More information about the wine-cvs
mailing list