| 71 | } |
| 72 | |
| 73 | void writeVarInt(uint64_t value) { |
| 74 | uint8_t bytes[10]; // Supports up to 64 bits |
| 75 | size_t index = 0; |
| 76 | |
| 77 | do { |
| 78 | uint8_t byte = value & 0x7F; // Lower 7 bits |
| 79 | value >>= 7; |
| 80 | if (value != 0) |
| 81 | byte |= 0x80; // Set continuation bit |
| 82 | bytes[index++] = byte; |
| 83 | } while (value != 0 && index < sizeof(bytes)); |
| 84 | |
| 85 | stream.write(reinterpret_cast<char *>(bytes), index); |
| 86 | } |
| 87 | |
| 88 | template <typename Enum, std::enable_if_t<std::is_enum<Enum>::value, int> = 0> |
| 89 | void writeVarInt(Enum value) { |
no test coverage detected