| 59 | } |
| 60 | |
| 61 | inline void EncodeFixed64(char *dst, uint64_t value) { |
| 62 | uint8_t *const buffer = reinterpret_cast<uint8_t *>(dst); |
| 63 | |
| 64 | // Recent clang and gcc optimize this to a single mov / str instruction. |
| 65 | buffer[0] = static_cast<uint8_t>(value); |
| 66 | buffer[1] = static_cast<uint8_t>(value >> 8); |
| 67 | buffer[2] = static_cast<uint8_t>(value >> 16); |
| 68 | buffer[3] = static_cast<uint8_t>(value >> 24); |
| 69 | buffer[4] = static_cast<uint8_t>(value >> 32); |
| 70 | buffer[5] = static_cast<uint8_t>(value >> 40); |
| 71 | buffer[6] = static_cast<uint8_t>(value >> 48); |
| 72 | buffer[7] = static_cast<uint8_t>(value >> 56); |
| 73 | } |
| 74 | |
| 75 | // Lower-level versions of Get... that read directly from a character buffer |
| 76 | // without any bounds checking. |