Created
August 27, 2015 04:05
-
-
Save rozap/7179ba0eccace90d3940 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def(at(<<var!(head) :: binary - size(2), rest :: binary>>, ptr, meta) when ptr >= 8 and ptr <= 9) do | |
new_posn = ptr + 2 | |
case({:meta, {:header_length, head}}) do | |
{:halt, _} = halt -> | |
halt | |
{:meta, {key, val}} -> | |
{rest, new_posn, Dict.put(meta, key, val), []} | |
result -> | |
{rest, new_posn, meta, [result]} | |
end | |
end | |
def(at(<<var!(head) :: binary - size(2), rest :: binary>>, ptr, meta) when ptr >= 10 and ptr <= 11) do | |
new_posn = ptr + 2 | |
case({:meta, {:record_length, head}}) do | |
{:halt, _} = halt -> | |
halt | |
{:meta, {key, val}} -> | |
{rest, new_posn, Dict.put(meta, key, val), []} | |
result -> | |
{rest, new_posn, meta, [result]} | |
end | |
end |
Author
rozap
commented
Aug 27, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment