Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defmodule Foo do
- @code1 0xA7
- @code2 0x1F
- @codes [@code1, @code2]
- def bar(<<type::signed-8, tail::binary>>), when type in @codes do: IO.inspect "Signed: #{type}"
- end
- # Both of these equal the same result
- <<type::signed-8, tail::binary>> = <<0xA7, 0x00>>;
- <<type::unsigned-8, tail::binary>> = <<0xA7, 0x00>>;
- # The whey won't this get into the def for bar?
- Foo.bar <<0xA7, 0x00>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement