3 // Decode an unsigned LEB128
4 // Algorithm from Appendix C of the DWARF 2, and 3, spec section "7.6"
5 unsigned long ReadULEB128(char *addr
)
7 unsigned long result
= 0;
14 result
|= (byte
& 0x7f) << shift
;
17 while ((byte
& 0x80));
23 // Decode a signed LEB128
24 // Algorithm from Appendix C of the DWARF 2, and 3, spec section "7.6"
25 long ReadLEB128(char *addr
)
34 result
|= (byte
& 0x7f) << shift
;
37 while ((byte
& 0x80));
39 if ((shift
< (8 * sizeof(result
))) && (byte
& 0x40))
41 result
|= (~0 << shift
);