| 180 | } |
| 181 | |
| 182 | long 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 | |
| 206 | std::string ReadString() |
| 207 | { |
no test coverage detected