MCPcopy Create free account
hub / github.com/GANGE666/xVMP / ReadVBR

Method ReadVBR

src/include/llvm/Bitcode/BitstreamReader.h:222–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220 }
221
222 uint32_t ReadVBR(unsigned NumBits) {
223 uint32_t Piece = Read(NumBits);
224 if ((Piece & (1U << (NumBits-1))) == 0)
225 return Piece;
226
227 uint32_t Result = 0;
228 unsigned NextBit = 0;
229 while (true) {
230 Result |= (Piece & ((1U << (NumBits-1))-1)) << NextBit;
231
232 if ((Piece & (1U << (NumBits-1))) == 0)
233 return Result;
234
235 NextBit += NumBits-1;
236 Piece = Read(NumBits);
237 }
238 }
239
240 // Read a VBR that may have a value up to 64-bits in size. The chunk size of
241 // the VBR must still be <= 32 bits though.

Callers 2

parseMetadataStringsMethod · 0.80

Calls 1

ReadFunction · 0.85

Tested by

no test coverage detected