~laumann/hadb

677b49ea84b89d5a3247313e4b34f5dc0289c696 — Thomas Bracht Laumann Jespersen 10 months ago 5db852b
format/dwarf: simple formatting
1 files changed, 4 insertions(+), 5 deletions(-)

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


@@ 21,7 21,6 @@ fn readuleb128(in: []u8) ((uleb128, size) | partialread) = {
// number of bytes used from the input.
fn readsleb128(in: []u8) ((sleb128, size) | partialread) = {
	let result = 0u;
	let sign = 0u8;
	let shift = 0u;

	for (let i = 0z; i < len(in); i += 1) {


@@ 30,10 29,10 @@ fn readsleb128(in: []u8) ((sleb128, size) | partialread) = {
		let bits: uint = byte & 0x7f;
		result |= bits << shift;

		sign = byte & 0x40;
		const neg = byte & 0x40 == 0x40;
		shift += 7;
		if (byte & 0x80 == 0) {
			if (sign == 0x40)
		if (byte&0x80 == 0) {
			if (byte&0x40 == 0x40)
				result |= ~((1u << shift)-1);
			return (result: sleb128, i+1);
		};