mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-02-25 15:46:03 +01:00
Fixed unit test failure on IBM AIX xlC by hard-coding the maxUInt64AsDouble as double constant instead of relying on double(Value::maxUInt64) which produces an incorrect value.
This commit is contained in:
parent
d3cd9a7fc5
commit
e807a7640e
@ -35,6 +35,10 @@ const UInt Value::maxUInt = UInt(-1);
|
|||||||
const Int64 Value::minInt64 = Int64( ~(UInt64(-1)/2) );
|
const Int64 Value::minInt64 = Int64( ~(UInt64(-1)/2) );
|
||||||
const Int64 Value::maxInt64 = Int64( UInt64(-1)/2 );
|
const Int64 Value::maxInt64 = Int64( UInt64(-1)/2 );
|
||||||
const UInt64 Value::maxUInt64 = UInt64(-1);
|
const UInt64 Value::maxUInt64 = UInt64(-1);
|
||||||
|
// The constant is hard-coded because some compiler have trouble
|
||||||
|
// converting Value::maxUInt64 to a double correctly (AIX/xlC).
|
||||||
|
// Assumes that UInt64 is a 64 bits integer.
|
||||||
|
static const double maxUInt64AsDouble = 18446744073709551615.0;
|
||||||
#endif // defined(JSON_HAS_INT64)
|
#endif // defined(JSON_HAS_INT64)
|
||||||
const LargestInt Value::minLargestInt = LargestInt( ~(LargestUInt(-1)/2) );
|
const LargestInt Value::minLargestInt = LargestInt( ~(LargestUInt(-1)/2) );
|
||||||
const LargestInt Value::maxLargestInt = LargestInt( LargestUInt(-1)/2 );
|
const LargestInt Value::maxLargestInt = LargestInt( LargestUInt(-1)/2 );
|
||||||
@ -1443,7 +1447,7 @@ Value::isUInt64() const
|
|||||||
// double, so double(maxUInt64) will be rounded up to 2^64. Therefore we
|
// double, so double(maxUInt64) will be rounded up to 2^64. Therefore we
|
||||||
// require the value to be strictly less than the limit.
|
// require the value to be strictly less than the limit.
|
||||||
return value_.real_ >= 0 &&
|
return value_.real_ >= 0 &&
|
||||||
value_.real_ < double(maxUInt64) &&
|
value_.real_ < maxUInt64AsDouble &&
|
||||||
IsIntegral(value_.real_);
|
IsIntegral(value_.real_);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user