| 380 | |
| 381 | template <typename Int> |
| 382 | inline bool BitReader::GetVlqInt(Int* v) { |
| 383 | static_assert(std::is_integral_v<Int>); |
| 384 | |
| 385 | // The data that we will pass to the LEB128 parser |
| 386 | // We read a byte-aligned value, skipping remaining bits. |
| 387 | // Also, we don't bother with the cache since the decoding would be the same. |
| 388 | int max_size = bytes_left(); |
| 389 | const uint8_t* data = buffer_ + (max_bytes_ - max_size); |
| 390 | |
| 391 | const auto bytes_read = bit_util::ParseLeadingLEB128(data, max_size, v); |
| 392 | if (ARROW_PREDICT_FALSE(bytes_read == 0)) { |
| 393 | // Corrupt LEB128 |
| 394 | return false; |
| 395 | } |
| 396 | |
| 397 | // Advance for the bytes we have read |
| 398 | return AdvanceBytes(bytes_read); |
| 399 | } |
| 400 | |
| 401 | template <typename Int> |
| 402 | inline bool BitWriter::PutZigZagVlqInt(Int v) { |
no test coverage detected