Permalink
Browse files

Keep argument order in unpack_continue/5 intact

It eliminates 4 "move" instructions in the assembly.
  • Loading branch information...
lexmag committed Jan 24, 2018
1 parent fecc6c0 commit 69cd8dffb03e6bab7440bcee158fc3458bc2ffe5
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/msgpax/unpacker.ex
@@ -141,23 +141,23 @@ defmodule Msgpax.Unpacker do
defp unpack_continue(rest, result, options, outer, index, count) do
case index + 1 do
^count ->
unpack_continue(rest, options, outer, result, count)
unpack_continue(rest, result, options, outer, count)
index ->
unpack(rest, result, options, outer, index, count)
end
end
defp unpack_continue(<<buffer::bits>>, options, [kind, index, length | outer], result, count) do
defp unpack_continue(<<buffer::bits>>, result, options, [kind, index, length | outer], count) do
result = build_collection(result, count, kind)
case index + 1 do
^length ->
unpack_continue(buffer, options, outer, result, length)
unpack_continue(buffer, result, options, outer, length)
index ->
unpack(buffer, result, options, outer, index, length)
end
end
defp unpack_continue(<<buffer::bits>>, _options, [], [value], 1) do
defp unpack_continue(<<buffer::bits>>, [value], _options, [], 1) do
{value, buffer}
end

0 comments on commit 69cd8df

Please sign in to comment.