Implemented Interface::Message.
[aesalon.git] / src / interface / dwarf / Parser.cpp
blob1ae3ec3eb8a37832673803a0410b3d86fded3508
1 #include "Parser.h"
3 namespace Aesalon {
4 namespace Interface {
5 namespace DWARF {
7 Word Parser::parse_leb128(Block block, bool is_signed) {
8 Word result = 0;
9 int shift = 0;
10 Word offset = 0;
12 while(true) {
13 if(is_signed) {
14 break;
16 else {
17 Byte next = block[offset++];
18 result |= (next & 0x7f) << shift;
19 if(next & 0x80) break;
21 shift += 7;
24 block.erase(block.begin(), block.begin() + offset);
26 return result;
29 } // namespace DWARF
30 } // namespace Interface
31 } // namespace Aesalon