If encoding and the sign bit is 1 (the number is negative), flip all the bits. If decoding and the sign bit is 0 (the number is negative), flip all the bits. Otherwise, the number is positive, so flip the sign bit.
| 51 | // If decoding and the sign bit is 0 (the number is negative), flip all the bits. |
| 52 | // Otherwise, the number is positive, so flip the sign bit. |
| 53 | static void adjustFloatingPoint(uint8_t* bytes, size_t size, bool encode) { |
| 54 | if ((encode && ((uint8_t)(bytes[0] & 0x80) != (uint8_t)0x00)) || |
| 55 | (!encode && ((uint8_t)(bytes[0] & 0x80) != (uint8_t)0x80))) { |
| 56 | for (size_t i = 0; i < size; i++) { |
| 57 | bytes[i] ^= (uint8_t)0xff; |
| 58 | } |
| 59 | } else { |
| 60 | bytes[0] ^= (uint8_t)0x80; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | Tuple::Tuple(StringRef const& str, bool exclude_incomplete, bool include_user_type) { |
| 65 | data.append(data.arena(), str.begin(), str.size()); |