| 1418 | } |
| 1419 | |
| 1420 | bool Value::isUInt64() const { |
| 1421 | #if defined(JSON_HAS_INT64) |
| 1422 | switch (type_) { |
| 1423 | case intValue: |
| 1424 | return value_.int_ >= 0; |
| 1425 | case uintValue: |
| 1426 | return true; |
| 1427 | case realValue: |
| 1428 | // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a |
| 1429 | // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we |
| 1430 | // require the value to be strictly less than the limit. |
| 1431 | return value_.real_ >= 0 && value_.real_ < maxUInt64AsDouble && |
| 1432 | IsIntegral(value_.real_); |
| 1433 | default: |
| 1434 | break; |
| 1435 | } |
| 1436 | #endif // JSON_HAS_INT64 |
| 1437 | return false; |
| 1438 | } |
| 1439 | |
| 1440 | bool Value::isIntegral() const { |
| 1441 | switch (type_) { |