Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion be/src/util/coding.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ extern uint8_t* encode_varint64(uint8_t* dst, uint64_t value);
inline uint8_t* encode_varint64(uint8_t* dst, uint64_t v) {
static const unsigned int B = 128;
while (v >= B) {
*(dst++) = (v & (B - 1)) | B;
// Fetch low seven bits from current v, and the eight bit is marked as compression mark.
// v | B is optimsed from (v & (B-1)) | B, because result is assgined to uint8_t and other bits
// is cleared by implicit conversion.
*(dst++) = v | B;
v >>= 7;
}
*(dst++) = static_cast<unsigned char>(v);
Expand Down