fixed win32 defines

This commit is contained in:
xantares 2014-12-23 16:23:08 +01:00
parent d247e1cf05
commit 1e28368222
2 changed files with 31 additions and 12 deletions

View File

@ -24,6 +24,25 @@
#include <float.h> #include <float.h>
#include <math.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 { namespace Poco {
@ -33,18 +52,18 @@ class Foundation_API FPEnvironmentImpl
protected: protected:
enum RoundingModeImpl enum RoundingModeImpl
{ {
FP_ROUND_DOWNWARD_IMPL = RC_DOWN, FP_ROUND_DOWNWARD_IMPL = _RC_DOWN,
FP_ROUND_UPWARD_IMPL = RC_UP, FP_ROUND_UPWARD_IMPL = _RC_UP,
FP_ROUND_TONEAREST_IMPL = RC_NEAR, FP_ROUND_TONEAREST_IMPL = _RC_NEAR,
FP_ROUND_TOWARDZERO_IMPL = RC_CHOP FP_ROUND_TOWARDZERO_IMPL = _RC_CHOP
}; };
enum FlagImpl enum FlagImpl
{ {
FP_DIVIDE_BY_ZERO_IMPL = SW_ZERODIVIDE, FP_DIVIDE_BY_ZERO_IMPL = _SW_ZERODIVIDE,
FP_INEXACT_IMPL = SW_INEXACT, FP_INEXACT_IMPL = _SW_INEXACT,
FP_OVERFLOW_IMPL = SW_OVERFLOW, FP_OVERFLOW_IMPL = _SW_OVERFLOW,
FP_UNDERFLOW_IMPL = SW_UNDERFLOW, FP_UNDERFLOW_IMPL = _SW_UNDERFLOW,
FP_INVALID_IMPL = SW_INVALID FP_INVALID_IMPL = _SW_INVALID
}; };
FPEnvironmentImpl(); FPEnvironmentImpl();
FPEnvironmentImpl(const FPEnvironmentImpl& env); FPEnvironmentImpl(const FPEnvironmentImpl& env);

View File

@ -34,7 +34,7 @@ FPEnvironmentImpl::FPEnvironmentImpl(const FPEnvironmentImpl& env)
FPEnvironmentImpl::~FPEnvironmentImpl() FPEnvironmentImpl::~FPEnvironmentImpl()
{ {
_controlfp(_env, MCW_RC); _controlfp(_env, _MCW_RC);
} }
@ -65,13 +65,13 @@ bool FPEnvironmentImpl::isFlagImpl(FlagImpl flag)
void FPEnvironmentImpl::setRoundingModeImpl(RoundingModeImpl mode) void FPEnvironmentImpl::setRoundingModeImpl(RoundingModeImpl mode)
{ {
_controlfp(mode, MCW_RC); _controlfp(mode, _MCW_RC);
} }
FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl() FPEnvironmentImpl::RoundingModeImpl FPEnvironmentImpl::getRoundingModeImpl()
{ {
return RoundingModeImpl(_controlfp(0, 0) & MCW_RC); return RoundingModeImpl(_controlfp(0, 0) & _MCW_RC);
} }