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

Method writeEncodedUint64

src/codec/utils/EncodeStream.cpp:166–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void EncodeStream::writeEncodedUint64(uint64_t value) {
167 static const uint64_t valueMask = 127;
168 static const uint8_t hasNext = 128;
169 uint8_t byte = 0;
170 for (int i = 0; i < 64; i += 7) {
171 byte = static_cast<uint8_t>(value & valueMask);
172 value >>= 7;
173 if (value > 0) {
174 byte |= hasNext;
175 }
176 if (!checkCapacity(1)) {
177 break;
178 }
179 bytes[_position++] = byte;
180 positionChanged(0);
181 if (value == 0) {
182 break;
183 }
184 }
185}
186
187void EncodeStream::writeBits(int32_t value, uint8_t numBits) {
188 auto data = static_cast<uint32_t>(value) << (33 - numBits);

Callers 1

WriteTimeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected