MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / readULEB128

Function readULEB128

src/Common/LLVMCoverageMapping.cpp:38–57  ·  view source on GitHub ↗

Read an unsigned LEB128 value from buf, advance buf, return value. Sets ok = false and returns 0 on truncated input or overflow.

Source from the content-addressed store, hash-verified

36/// Read an unsigned LEB128 value from buf, advance buf, return value.
37/// Sets ok = false and returns 0 on truncated input or overflow.
38uint64_t readULEB128(const uint8_t *& buf, const uint8_t * end, bool & ok)
39{
40 uint64_t result = 0;
41 int shift = 0;
42 while (buf < end)
43 {
44 const uint8_t byte = *buf++;
45 result |= static_cast<uint64_t>(byte & 0x7fu) << shift;
46 if (!(byte & 0x80u))
47 return result;
48 shift += 7;
49 if (shift >= 64)
50 {
51 ok = false;
52 return 0;
53 }
54 }
55 ok = false;
56 return 0;
57}
58
59/// One parsed filename table from a `__llvm_covmap` header block.
60struct FilenameTable

Callers 2

parseCovMapFilenamesFunction · 0.85
readLLVMCoverageMappingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected