anchor.diff:  unpack(Bin) when not is_binary(Bin)->
       {error, badarg};
   unpack(Bin) when bit_size(Bin) >= 8 ->
  -    << Flag:8/unsigned-integer, Payload/binary >> = Bin,
  -    unpack_(Flag, Payload);
  -unpack(<<>>)-> % when bit_size(Bin) < 8 ->
  -    {more, 1}.
  +    unpack_(Bin);
  +unpack(<<>>)->
  +    {more, 1};
  +unpack(_) ->
  +    {more, undefined}.
   
   -spec unpack_all( binary() ) -> [msgpack_term()].
   unpack_all(Data)->
  
positive.code: 	    [Term|unpack_all(Binary)]
      end.
  
  pack_map(M)->
      case length(M) of
  	Len when Len < 16 ->
  
negative.code: 	    end
      end.
  
  -spec unpack_(Payload::binary()) -> 
  		     {more, pos_integer()} | {msgpack_term(), binary()} | {error, reason()}.
  unpack_(Binary)->
      case Binary of
  % ATOMS
  	<<16#C0, Rest/binary>> -> {nil, Rest};
  	<<16#C2, Rest/binary>> -> {false, Rest};
  	<<16#C3, Rest/binary>> -> {true, Rest};
  % Floats
  	<<16#CA, Val:32/float-unit:1, Rest/binary>> ->   {Val, Rest};
  	<<16#CB, Val:64/float-unit:1, Rest/binary>> ->   {Val, Rest};
  % Unsigned integers
  	<<16#CC, Val:8/unsigned-integer, Rest/binary>> ->             {Val, Rest};
  	<<16#CD, Val:16/big-unsigned-integer-unit:1, Rest/binary>> -> {Val, Rest};
  	<<16#CE, Val:32/big-unsigned-integer-unit:1, Rest/binary>> -> {Val, Rest};
  	<<16#CF, Val:64/big-unsigned-integer-unit:1, Rest/binary>> -> {Val, Rest};
  % Signed integers
  	<<16#D0, Val:8/signed-integer, Rest/binary>> ->             {Val, Rest};
  	<<16#D1, Val:16/big-signed-integer-unit:1, Rest/binary>> -> {Val, Rest};
  	<<16#D2, Val:32/big-signed-integer-unit:1, Rest/binary>> -> {Val, Rest};
  	<<16#D3, Val:64/big-signed-integer-unit:1, Rest/binary>> -> {Val, Rest};
  % Raw bytes
  	<<16#DA, Len:16/unsigned-integer-unit:1, Val:Len/binary, Rest/binary>> -> {Val, Rest};
  	<<16#DB, Len:32/unsigned-integer-unit:1, Val:Len/binary, Rest/binary>> -> {Val, Rest};
  % Arrays
  	<<16#DC, Len:16/big-unsigned-integer-unit:1, Rest/binary>> -> unpack_array_(Rest, Len, []);
  	<<16#DD, Len:32/big-unsigned-integer-unit:1, Rest/binary>> -> unpack_array_(Rest, Len, []);
  % Maps
  	<<16#DE, Len:16/big-unsigned-integer-unit:1, Rest/binary>> -> unpack_map_(Rest, Len, []);
  	<<16#DF, Len:32/big-unsigned-integer-unit:1, Rest/binary>> -> unpack_map_(Rest, Len, []);
  
  % Tag-encoded lengths (kept last, for speed)
  	<<0:1, Val:7, Rest/binary>> ->                      {Val, Rest};                  % positive int
  	<<2#111:3, Val:5, Rest/binary>> ->                  {Val - 2#100000, Rest};       % negative int
  	<<2#101:3, Len:5, Val:Len/binary, Rest/binary>> ->  {Val, Rest};                  % raw bytes
  	<<2#1001:4, Len:4, Rest/binary>> ->                 unpack_array_(Rest, Len, []); % array
  	<<2#1000:4, Len:4, Rest/binary>> ->                 unpack_map_(Rest, Len, []);   % map
  	
  % Incomplete / invalid data
  	<<16#CA, Rest/binary>> -> {more, 4-byte_size(Rest)};
  	<<16#CB, Rest/binary>> -> {more, 8-byte_size(Rest)};
  	<<16#CC>> ->              {more, 1};
  	<<16#CD, Rest/binary>> -> {more, 2-byte_size(Rest)};
  	<<16#CE, Rest/binary>> -> {more, 4-byte_size(Rest)};
  	<<16#CF, Rest/binary>> -> {more, 8-byte_size(Rest)};
  	<<16#D0>> ->              {more, 1};
  	<<16#D1, Rest/binary>> -> {more, 2-byte_size(Rest)};
  	<<16#D2, Rest/binary>> -> {more, 4-byte_size(Rest)};
  	<<16#D3, Rest/binary>> -> {more, 8-byte_size(Rest)};
  	<<16#DA, Rest/binary>> -> {more, 16-byte_size(Rest)};
  	<<16#DB, Rest/binary>> -> {more, 32-byte_size(Rest)};
  	<<16#DC, Rest/binary>> -> {more, 2-byte_size(Rest)};
  	<<16#DD, Rest/binary>> -> {more, 4-byte_size(Rest)};
  	<<16#DE, Rest/binary>> -> {more, 2-byte_size(Rest)};
  	<<16#DF, Rest/binary>> -> {more, 4-byte_size(Rest)};
  	<<2#101:3, Len:5, Rest/binary>> ->  {more, Len-byte_size(Rest)};
  
  	<<>> ->                  {more, 1};
  	<<2#101:3, _/binary>> -> {more, undefined};
  	<<F:8, Rest/binary>> when F==16#C1;
  				  F==16#C7; F==16#C8; F==16#C9; F==16#D5;
  				  F==16#D6; F==16#D7; F==16#D8; F==16#D9->
  	    {error, {badarg, <<F, Rest/binary>>}};
  	Other ->
  	    {error, {badarg, Other}}
      end.
  
  
  % ===== test codes ===== %
  -include_lib("eunit/include/eunit.hrl").
  