File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1360,11 +1360,23 @@ bool Value::isUInt64() const {
13601360}
13611361
13621362bool Value::isIntegral () const {
1363+ switch (type_) {
1364+ case intValue:
1365+ case uintValue:
1366+ return true ;
1367+ case realValue:
13631368#if defined(JSON_HAS_INT64)
1364- return isInt64 () || isUInt64 ();
1369+ // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a
1370+ // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we
1371+ // require the value to be strictly less than the limit.
1372+ return value_.real_ >= double (minInt64) && value_.real_ < maxUInt64AsDouble && IsIntegral (value_.real_ );
13651373#else
1366- return isInt () || isUInt ();
1367- #endif
1374+ return value_.real_ >= minInt && value_.real_ <= maxUInt && IsIntegral (value_.real_ );
1375+ #endif // JSON_HAS_INT64
1376+ default :
1377+ break ;
1378+ }
1379+ return false ;
13681380}
13691381
13701382bool Value::isDouble () const { return type_ == intValue || type_ == uintValue || type_ == realValue; }
You can’t perform that action at this time.
0 commit comments