19 if ((b & 0x80) == 0)
return val;
21 val |=
static_cast<uint32_t
>(b & 0x7f) << 7;
22 if ((b & 0x80) == 0)
return val;
24 val |=
static_cast<uint32_t
>(b & 0x7f) << 14;
25 if ((b & 0x80) == 0)
return val;
27 val |=
static_cast<uint32_t
>(b & 0x7f) << 21;
28 if ((b & 0x80) == 0)
return val;
30 val |=
static_cast<uint32_t
>(b & 0x7f) << 28;
31 assert((b & 0x80) == 0);
46 if ((b & 0x80) == 0)
return val;
48 val |=
static_cast<uint64_t
>(b & 0x7f) << 7;
49 if ((b & 0x80) == 0)
return val;
51 val |=
static_cast<uint64_t
>(b & 0x7f) << 14;
52 if ((b & 0x80) == 0)
return val;
54 val |=
static_cast<uint64_t
>(b & 0x7f) << 21;
55 if ((b & 0x80) == 0)
return val;
57 val |=
static_cast<uint64_t
>(b & 0x7f) << 28;
58 if ((b & 0x80) == 0)
return val;
60 val |=
static_cast<uint64_t
>(b & 0x7f) << 35;
61 if ((b & 0x80) == 0)
return val;
63 val |=
static_cast<uint64_t
>(b & 0x7f) << 42;
64 if ((b & 0x80) == 0)
return val;
66 val |=
static_cast<uint64_t
>(b & 0x7f) << 49;
67 if ((b & 0x80) == 0)
return val;
69 val |=
static_cast<uint64_t
>(b & 0x7f) << 56;
70 if ((b & 0x80) == 0)
return val;
72 val |=
static_cast<uint64_t
>(b & 0x7f) << 63;
73 assert((b & 0x80) == 0);
81 return static_cast<int32_t
>((val >> 1) ^ -(val & 1));
87 return (val >> 1) ^ -(val & 1);
94 std::string_view sv(
reinterpret_cast<const char*
>(p), len);
102 const char* p =
reinterpret_cast<const char*
>(pStart);
105 if (*p++ >= 0) count++;
115 count -= (b >> 7) ^ 1;
133 count -= (b >> 7) ^ 1;
143 *p++ = (val & 0x7f) | 0x80;
146 *p++ =
static_cast<uint8_t
>(val);
162 return (64 - Bits::countLeadingZerosInNonZero64(v | 1) + 6) / 7;
168 return (v << 1) ^ (v >> 63);
173 return (v << 1) ^ (v >> 31);
178 return static_cast<int64_t
>((v >> 1) ^ -
static_cast<int64_t
>(v & 1));
183 return static_cast<int32_t
>((v >> 1) ^ -
static_cast<int32_t
>(v & 1));
int countVarints(const void *pStart, const void *pEnd)
Definition varint.h:99
uint64_t readVarint35(const uint8_t *&p)
Definition varint.h:13
void skipVarints(const uint8_t *&p, int count)
Definition varint.h:110
std::string_view readStringView(const uint8_t *&p)
Definition varint.h:91
uint64_t toZigzag(int64_t v)
Definition varint.h:166
void writeSignedVarint(uint8_t *&p, int64_t val)
Definition varint.h:150
int64_t readSignedVarint64(const uint8_t *&p)
Definition varint.h:84
int32_t readSignedVarint32(const uint8_t *&p)
Definition varint.h:78
uint64_t readVarint64(const uint8_t *&p)
Definition varint.h:40
int64_t fromZigzag(uint64_t v)
Definition varint.h:176
unsigned int varintSize(uint64_t v)
Returns the number of bytes required to encode the given unsigned value as a varint (A varint require...
Definition varint.h:160
uint32_t readVarint32(const uint8_t *&p)
Definition varint.h:35
void skipVarintsBackwardUnsafe(const uint8_t *&p, int count)
Moves pointer backward, skipping over the specified numbers of varints.
Definition varint.h:127
void writeVarint(uint8_t *&p, uint64_t val)
Definition varint.h:139