MCPcopy Create free account
hub / github.com/apache/arrow / GetVlqInt

Method GetVlqInt

cpp/src/arrow/util/bit_stream_utils_internal.h:382–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

380
381template <typename Int>
382inline 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
401template <typename Int>
402inline bool BitWriter::PutZigZagVlqInt(Int v) {

Callers 1

InitHeaderMethod · 0.80

Calls 1

ParseLeadingLEB128Function · 0.85

Tested by

no test coverage detected