Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ndpar committed Jan 6, 2018
1 parent cf622bc commit 88a0b68
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/bin.erl
@@ -1,13 +1,14 @@
%
% J. Armstrong, Programming Erlang, Chapter 7
% Various functions to work on binaries.
%
-module(bin).
-export([lxor/1, lxor/2]).
-export([reverse_bytes/1, reverse_bits/1]).
-export([term_to_packet/1, packet_to_term/1]).


% Left XOR
% Left XOR.
% E.g. ABCDEF xor 1234 = B9F9
-spec lxor(binary(), binary()) -> binary().

lxor(X, Y) ->
Expand Down Expand Up @@ -42,6 +43,10 @@ bin_to_hexstr(Bin) ->
binary_to_list(<<<<Y>> || <<X:4>> <= Bin, Y <- integer_to_list(X, 16)>>).


%
% J. Armstrong, Programming Erlang, Chapter 7
%

reverse_bytes(B) ->
list_to_binary(lists:reverse(binary_to_list(B))).

Expand Down

0 comments on commit 88a0b68

Please sign in to comment.