| 282 | } |
| 283 | |
| 284 | static inline uint8_t* EncodeSignedLeb128(uint8_t* dest, int32_t value) { |
| 285 | uint32_t extra_bits = static_cast<uint32_t>(value ^ (value >> 31)) >> 6; |
| 286 | uint8_t out = value & 0x7f; |
| 287 | while (extra_bits != 0u) { |
| 288 | *dest++ = out | 0x80; |
| 289 | value >>= 7; |
| 290 | out = value & 0x7f; |
| 291 | extra_bits >>= 7; |
| 292 | } |
| 293 | *dest++ = out; |
| 294 | return dest; |
| 295 | } |
| 296 | |
| 297 | template<typename Vector> |
| 298 | static inline void EncodeSignedLeb128(Vector* dest, int32_t value) { |