anchor.diff:  		true -> ok
   	end.
   
  +unmask(Data, undefined, _) ->
  +	Data;
   unmask(Data, MaskKey, 0) ->
  -	do_unmask(Data, MaskKey, <<>>);
  +	mask(Data, MaskKey, <<>>);
   %% We unmask on the fly so we need to continue from the right mask byte.
   unmask(Data, MaskKey, UnmaskedLen) ->
   	Left = UnmaskedLen rem 4,
   	Right = 4 - Left,
   	MaskKey2 = (MaskKey bsl (Left * 8)) + (MaskKey bsr (Right * 8)),
  -	do_unmask(Data, MaskKey2, <<>>).
  -
  -do_unmask(<<>>, _, Unmasked) ->
  +	mask(Data, MaskKey2, <<>>).
  +
  +mask(<<>>, _, Unmasked) ->
   	Unmasked;
  -do_unmask(<< O:32, Rest/bits >>, MaskKey, Acc) ->
  +mask(<< O:32, Rest/bits >>, MaskKey, Acc) ->
   	T = O bxor MaskKey,
  -	do_unmask(Rest, MaskKey, << Acc/binary, T:32 >>);
  -do_unmask(<< O:24 >>, MaskKey, Acc) ->
  +	mask(Rest, MaskKey, << Acc/binary, T:32 >>);
  +mask(<< O:24 >>, MaskKey, Acc) ->
   	<< MaskKey2:24, _:8 >> = << MaskKey:32 >>,
   	T = O bxor MaskKey2,
   	<< Acc/binary, T:24 >>;
  -do_unmask(<< O:16 >>, MaskKey, Acc) ->
  +mask(<< O:16 >>, MaskKey, Acc) ->
   	<< MaskKey2:16, _:16 >> = << MaskKey:32 >>,
   	T = O bxor MaskKey2,
   	<< Acc/binary, T:16 >>;
  -do_unmask(<< O:8 >>, MaskKey, Acc) ->
  +mask(<< O:8 >>, MaskKey, Acc) ->
   	<< MaskKey2:8, _:24 >> = << MaskKey:32 >>,
   	T = O bxor MaskKey2,
   	<< Acc/binary, T:8 >>.
   
  -%% @todo Try using iodata() and see if it improves anything.
   inflate_frame(Data, Inflate, TakeOver, FragState, true)
   		when FragState =:= undefined; element(1, FragState) =:= fin ->
   	Data2 = zlib:inflate(Inflate, << Data/binary, 0, 0, 255, 255 >>),
  
positive.code: 	Len = payload_length(Payload),
  	[<< 1:1, 0:3, 2:4, 0:1, Len/bits >>, Payload].
  
  payload_length(Payload) ->
  	case byte_size(Payload) of
  		N when N =< 125 -> << N:7 >>;
  
negative.code: 
  -module(cow_ws).
  
  -export([key/0]).
  -export([encode_key/1]).
  
  -export([negotiate_permessage_deflate/3]).
  -export([negotiate_x_webkit_deflate_frame/3]).
  
  -export([validate_permessage_deflate/3]).
  
  -export([parse_header/3]).
  -export([parse_payload/9]).
  -export([make_frame/4]).
  
  -export([frame/2]).
  -export([masked_frame/2]).
  
  -type close_code() :: 1000..1003 | 1006..1011 | 3000..4999.
  -export_type([close_code/0]).
  
  -type extensions() :: map().
  -export_type([extensions/0]).
  
  -type frag_state() :: undefined | {fin | nofin, text | binary, rsv()}.
  -export_type([frag_state/0]).
  