WIXLCHRK3GSLGI2PCH6UPM5OUATTFFM4RXNWNIAYNDNEAXPBLK5AC
AG6DXQCD3XMB5GTP5AIHQTYJUMDRK24I4UTTCTWVH7O5KPATUPLQC
end test "Decode unsigned" do assert WaParser.LEB128.decode_unsigned(<<0x00>>) == 0 assert WaParser.LEB128.decode_unsigned(<<0x2A>>) == 42 assert WaParser.LEB128.decode_unsigned(<<0xE5, 0x8E, 0x26>>) == 624_485
end
test "Decode unsigned" do
assert WaParser.LEB128.decode_unsigned(<<0x00>>) == 0
assert WaParser.LEB128.decode_unsigned(<<0x2A>>) == 42
assert WaParser.LEB128.decode_unsigned(<<0xE5, 0x8E, 0x26>>) == 624_485
end def decode_unsigned(<<0x00>>) do 0 end def decode_unsigned(<<int>>) do int
def decode_unsigned(<<0x00>>) do
0
def decode_unsigned(<<int>>) do
int
def decode_unsigned(bytes) do {result, _} = for <<(<<_sign::1, byte::7>> <- bytes)>>, reduce: {0, 0} do {result, m} -> result = Bitwise.bor(result, Bitwise.bsl(byte, 7 * m)) {result, m + 1} end result end
def decode_unsigned(bytes) do
{result, _} =
for <<(<<_sign::1, byte::7>> <- bytes)>>, reduce: {0, 0} do
{result, m} ->
result = Bitwise.bor(result, Bitwise.bsl(byte, 7 * m))
{result, m + 1}
result