ieee754.h (rapidjson-1.0.2) | : | ieee754.h (rapidjson-1.1.0) | ||
---|---|---|---|---|
skipping to change at line 43 | skipping to change at line 43 | |||
RAPIDJSON_ASSERT(!Sign()); | RAPIDJSON_ASSERT(!Sign()); | |||
return Double(u_ + 1).Value(); | return Double(u_ + 1).Value(); | |||
} | } | |||
bool Sign() const { return (u_ & kSignMask) != 0; } | bool Sign() const { return (u_ & kSignMask) != 0; } | |||
uint64_t Significand() const { return u_ & kSignificandMask; } | uint64_t Significand() const { return u_ & kSignificandMask; } | |||
int Exponent() const { return static_cast<int>(((u_ & kExponentMask) >> kSig nificandSize) - kExponentBias); } | int Exponent() const { return static_cast<int>(((u_ & kExponentMask) >> kSig nificandSize) - kExponentBias); } | |||
bool IsNan() const { return (u_ & kExponentMask) == kExponentMask && Signifi cand() != 0; } | bool IsNan() const { return (u_ & kExponentMask) == kExponentMask && Signifi cand() != 0; } | |||
bool IsInf() const { return (u_ & kExponentMask) == kExponentMask && Signifi cand() == 0; } | bool IsInf() const { return (u_ & kExponentMask) == kExponentMask && Signifi cand() == 0; } | |||
bool IsNanOrInf() const { return (u_ & kExponentMask) == kExponentMask; } | ||||
bool IsNormal() const { return (u_ & kExponentMask) != 0 || Significand() == 0; } | bool IsNormal() const { return (u_ & kExponentMask) != 0 || Significand() == 0; } | |||
bool IsZero() const { return (u_ & (kExponentMask | kSignificandMask)) == 0; } | bool IsZero() const { return (u_ & (kExponentMask | kSignificandMask)) == 0; } | |||
uint64_t IntegerSignificand() const { return IsNormal() ? Significand() | kH iddenBit : Significand(); } | uint64_t IntegerSignificand() const { return IsNormal() ? Significand() | kH iddenBit : Significand(); } | |||
int IntegerExponent() const { return (IsNormal() ? Exponent() : kDenormalExp onent) - kSignificandSize; } | int IntegerExponent() const { return (IsNormal() ? Exponent() : kDenormalExp onent) - kSignificandSize; } | |||
uint64_t ToBias() const { return (u_ & kSignMask) ? ~u_ + 1 : u_ | kSignMask ; } | uint64_t ToBias() const { return (u_ & kSignMask) ? ~u_ + 1 : u_ | kSignMask ; } | |||
static unsigned EffectiveSignificandSize(int order) { | static unsigned EffectiveSignificandSize(int order) { | |||
if (order >= -1021) | if (order >= -1021) | |||
return 53; | return 53; | |||
else if (order <= -1074) | else if (order <= -1074) | |||
return 0; | return 0; | |||
else | else | |||
return order + 1074; | return static_cast<unsigned>(order) + 1074; | |||
} | } | |||
private: | private: | |||
static const int kSignificandSize = 52; | static const int kSignificandSize = 52; | |||
static const int kExponentBias = 0x3FF; | static const int kExponentBias = 0x3FF; | |||
static const int kDenormalExponent = 1 - kExponentBias; | static const int kDenormalExponent = 1 - kExponentBias; | |||
static const uint64_t kSignMask = RAPIDJSON_UINT64_C2(0x80000000, 0x00000000 ); | static const uint64_t kSignMask = RAPIDJSON_UINT64_C2(0x80000000, 0x00000000 ); | |||
static const uint64_t kExponentMask = RAPIDJSON_UINT64_C2(0x7FF00000, 0x0000 0000); | static const uint64_t kExponentMask = RAPIDJSON_UINT64_C2(0x7FF00000, 0x0000 0000); | |||
static const uint64_t kSignificandMask = RAPIDJSON_UINT64_C2(0x000FFFFF, 0xF FFFFFFF); | static const uint64_t kSignificandMask = RAPIDJSON_UINT64_C2(0x000FFFFF, 0xF FFFFFFF); | |||
static const uint64_t kHiddenBit = RAPIDJSON_UINT64_C2(0x00100000, 0x0000000 0); | static const uint64_t kHiddenBit = RAPIDJSON_UINT64_C2(0x00100000, 0x0000000 0); | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added |