MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / ReadLEB128

Function ReadLEB128

TombEngine/Specific/level.cpp:182–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182long long ReadLEB128(bool sign)
183{
184 long long result = 0;
185 int currentShift = 0;
186
187 unsigned char currentByte;
188 do
189 {
190 currentByte = ReadUInt8();
191
192 result |= (long long)(currentByte & 0x7F) << currentShift;
193 currentShift += 7;
194 } while ((currentByte & 0x80) != 0);
195
196 if (sign) // Sign extend
197 {
198 int shift = 64 - currentShift;
199 if (shift > 0)
200 result = (long long)(result << shift) >> shift;
201 }
202
203 return result;
204}
205
206std::string ReadString()
207{

Callers 1

ReadStringFunction · 0.85

Calls 1

ReadUInt8Function · 0.85

Tested by

no test coverage detected