~laumann/hadb

5db852b36b87a463519b37cc354236e6128e47fd — Thomas Bracht Laumann Jespersen 4 months ago a42eb2c
format/dwarf: save a line in read{u,s}leb128()
1 files changed, 2 insertions(+), 4 deletions(-)

M format/dwarf/leb128.ha
M format/dwarf/leb128.ha => format/dwarf/leb128.ha +2 -4
@@ 9,8 9,7 @@ fn readuleb128(in: []u8) ((uleb128, size) | partialread) = {
	for (let i = 0z; i < len(in); i += 1) {
		const byte = in[i];
		let bits: uleb128 = byte & 0x7f;
		bits <<= shift;
		result |= bits;
		result |= bits << shift;
		if (byte & 0x80 == 0)
			return (result, i+1);
		shift += 7;


@@ 29,8 28,7 @@ fn readsleb128(in: []u8) ((sleb128, size) | partialread) = {
		const byte = in[i];

		let bits: uint = byte & 0x7f;
		bits <<= shift;
		result |= bits;
		result |= bits << shift;

		sign = byte & 0x40;
		shift += 7;