| 1366 | } |
| 1367 | |
| 1368 | bool Value::isUInt64() const { |
| 1369 | #if defined(JSON_HAS_INT64) |
| 1370 | switch (type_) { |
| 1371 | case intValue: |
| 1372 | return value_.int_ >= 0; |
| 1373 | case uintValue: |
| 1374 | return true; |
| 1375 | case realValue: |
| 1376 | // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a |
| 1377 | // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we |
| 1378 | // require the value to be strictly less than the limit. |
| 1379 | return value_.real_ >= 0 && value_.real_ < maxUInt64AsDouble && |
| 1380 | IsIntegral(value_.real_); |
| 1381 | default: |
| 1382 | break; |
| 1383 | } |
| 1384 | #endif // JSON_HAS_INT64 |
| 1385 | return false; |
| 1386 | } |
| 1387 | |
| 1388 | bool Value::isIntegral() const { |
| 1389 | switch (type_) { |