Skip to content

Instantly share code, notes, and snippets.

@KamilLelonek
Last active July 8, 2018 08:29
Show Gist options
  • Save KamilLelonek/b2775a8e28a14cf4bca6e2bfc9eb6598 to your computer and use it in GitHub Desktop.
Save KamilLelonek/b2775a8e28a14cf4bca6e2bfc9eb6598 to your computer and use it in GitHub Desktop.
def compress(<<0x04::8, x_coordinate::256, y_coordinate::256>>) do
y_coordinate
|> rem(2)
|> compress(x_coordinate)
end
def compress(0, x_coordinate), do: <<0x02::8, x_coordinate::256>>
def compress(1, x_coordinate), do: <<0x03::8, x_coordinate::256>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment