| 1484 | } |
| 1485 | |
| 1486 | bool Value::isInt64() const { |
| 1487 | #if defined(JSON_HAS_INT64) |
| 1488 | switch (type()) { |
| 1489 | case intValue: |
| 1490 | return true; |
| 1491 | case uintValue: |
| 1492 | return value_.uint_ <= UInt64(maxInt64); |
| 1493 | case realValue: |
| 1494 | // Note that maxInt64 (= 2^63 - 1) is not exactly representable as a |
| 1495 | // double, so double(maxInt64) will be rounded up to 2^63. Therefore we |
| 1496 | // require the value to be strictly less than the limit. |
| 1497 | // minInt64 is -2^63 which can be represented as a double, but since double |
| 1498 | // values in its proximity are also rounded to -2^63, we require the value |
| 1499 | // to be strictly greater than the limit to avoid returning 'true' for |
| 1500 | // values that are not in the range |
| 1501 | return value_.real_ > double(minInt64) && value_.real_ < double(maxInt64) && IsIntegral(value_.real_); |
| 1502 | default: |
| 1503 | break; |
| 1504 | } |
| 1505 | #endif // JSON_HAS_INT64 |
| 1506 | return false; |
| 1507 | } |
| 1508 | |
| 1509 | bool Value::isUInt64() const { |
| 1510 | #if defined(JSON_HAS_INT64) |
nothing calls this directly
no test coverage detected