| 45 | } |
| 46 | |
| 47 | inline bool FastMathSafeIsInf(double x) { |
| 48 | #ifdef __FAST_MATH__ |
| 49 | // IEEE 754 standard: https://en.wikipedia.org/wiki/IEEE_754 |
| 50 | // Inf is encoded as all 1s in the exponent and zero in the mantissa |
| 51 | static_assert(sizeof(double) == sizeof(uint64_t), "Unexpected double size"); |
| 52 | uint64_t bits = *reinterpret_cast<const uint64_t*>(&x); |
| 53 | uint64_t exponent = (bits >> 52) & 0x7FF; |
| 54 | uint64_t mantissa = bits & 0xFFFFFFFFFFFFFull; |
| 55 | // inf is encoded as all 1s in the exponent and zero in the mantissa |
| 56 | return (exponent == 0x7FF) && (mantissa == 0); |
| 57 | #else |
| 58 | return std::isinf(x); |
| 59 | #endif |
| 60 | } |
| 61 | |
| 62 | TEST(JSONParser, BoolNull) { |
| 63 | // boolean value |
no outgoing calls
no test coverage detected