diff --git a/Foundation/include/Poco/FPEnvironment_WIN32.h b/Foundation/include/Poco/FPEnvironment_WIN32.h index 33310289b..17b720795 100644 --- a/Foundation/include/Poco/FPEnvironment_WIN32.h +++ b/Foundation/include/Poco/FPEnvironment_WIN32.h @@ -24,6 +24,25 @@ #include #include +#ifndef _SW_INEXACT + #define _SW_INEXACT 0x00000001 /* inexact (precision) */ +#endif +#ifndef _SW_UNDERFLOW + #define _SW_UNDERFLOW 0x00000002 /* underflow */ +#endif +#ifndef _SW_OVERFLOW + #define _SW_OVERFLOW 0x00000004 /* overflow */ +#endif +#ifndef _SW_ZERODIVIDE + #define _SW_ZERODIVIDE 0x00000008 /* zero divide */ +#endif +#ifndef _SW_INVALID + #define _SW_INVALID 0x00000010 /* invalid */ +#endif +#ifndef _SW_DENORMAL + #define _SW_DENORMAL 0x00080000 /* denormal status bit */ +#endif + namespace Poco { @@ -33,18 +52,18 @@ class Foundation_API FPEnvironmentImpl protected: enum RoundingModeImpl { - FP_ROUND_DOWNWARD_IMPL = RC_DOWN, - FP_ROUND_UPWARD_IMPL = RC_UP, - FP_ROUND_TONEAREST_IMPL = RC_NEAR, - FP_ROUND_TOWARDZERO_IMPL = RC_CHOP + FP_ROUND_DOWNWARD_IMPL = _RC_DOWN, + FP_ROUND_UPWARD_IMPL = _RC_UP, + FP_ROUND_TONEAREST_IMPL = _RC_NEAR, + FP_ROUND_TOWARDZERO_IMPL = _RC_CHOP }; enum FlagImpl { - FP_DIVIDE_BY_ZERO_IMPL = SW_ZERODIVIDE, - FP_INEXACT_IMPL = SW_INEXACT, - FP_OVERFLOW_IMPL = SW_OVERFLOW, - FP_UNDERFLOW_IMPL = SW_UNDERFLOW, - FP_INVALID_IMPL = SW_INVALID + FP_DIVIDE_BY_ZERO_IMPL = _SW_ZERODIVIDE, + FP_INEXACT_IMPL = _SW_INEXACT, + FP_OVERFLOW_IMPL = _SW_OVERFLOW, + FP_UNDERFLOW_IMPL = _SW_UNDERFLOW, + FP_INVALID_IMPL = _SW_INVALID }; FPEnvironmentImpl(); FPEnvironmentImpl(const FPEnvironmentImpl& env); diff --git a/Foundation/src/FPEnvironment_WIN32.cpp b/Foundation/src/FPEnvironment_WIN32.cpp index ebbb763e2..9f51b69c7 100644 --- a/Foundation/src/FPEnvironment_WIN32.cpp +++ b/Foundation/src/FPEnvironment_WIN32.cpp @@ -34,7 +34,7 @@ FPEnvironmentImpl::FPEnvironmentImpl(const FPEnvironmentImpl& env) FPEnvironmentImpl::~FPEnvironmentImpl() { - _controlfp(_env, MCW_RC); + _controlfp(_env, _MCW_RC); } @@ -65,13 +65,13 @@ bool FPEnvironmentImpl::isFlagImpl(FlagImpl flag) void FPEnvironmentImpl::setRoundingModeImpl(RoundingModeImpl mode) { - _controlfp(mode, MCW_RC); + _controlfp(mode, _MCW_RC); } FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl() { - return RoundingModeImpl(_controlfp(0, 0) & MCW_RC); + return RoundingModeImpl(_controlfp(0, 0) & _MCW_RC); }