Merge pull request #654 from xantares/win32_defines

fixed win32 defines
This commit is contained in:
Aleksandar Fabijanic 2015-01-01 12:16:57 -06:00
commit f8e906171e
2 changed files with 31 additions and 12 deletions

View File

@ -24,6 +24,25 @@
#include <float.h>
#include <math.h>
#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);

View File

@ -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);
}