MCPcopy Create free account
hub / github.com/Tencent/libpag / readEncodedUint64

Method readEncodedUint64

src/codec/utils/DecodeStream.cpp:201–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201uint64_t DecodeStream::readEncodedUint64() {
202 static const uint64_t valueMask = 127;
203 static const uint8_t hasNext = 128;
204 uint64_t value = 0;
205 uint64_t byte = 0;
206 auto length = dataView.size();
207 auto bytes = dataView.bytes();
208 for (int i = 0; i < 64; i += 7) {
209 if (_position >= length) {
210 PAGThrowError(context, "End of file was encountered.");
211 break;
212 }
213 byte = bytes[_position++];
214 value |= (byte & valueMask) << i;
215 if ((byte & hasNext) == 0) {
216 break;
217 }
218 }
219 positionChanged(0);
220 return value;
221}
222
223int32_t DecodeStream::readBits(uint8_t numBits) {
224 auto value = readUBits(numBits);

Callers 1

ReadTimeFunction · 0.45

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected