anchor.diff:      <<N:Len/unit:8,Buffer2/binary>> = <<B2,Bs/binary>>,
       Int = N - (1 bsl (8 * Len - 1)),
       {Int,Buffer2,RemovedBytes}.
  -
  -%%decode_integer2(Len,Buffer,Acc,RemovedBytes) when (hd(Buffer) band 16#FF) =< 16#7F ->
  -%%    {decode_integer_pos(Buffer, 8 * (Len - 1)),skip(Buffer,Len),RemovedBytes};
  -%%decode_integer2(Len,Buffer,Acc,RemovedBytes)  ->
  -%%    {decode_integer_neg(Buffer, 8 * (Len - 1)),skip(Buffer,Len),RemovedBytes}.
  -
  -%%decode_integer_pos([Byte|Tail], Shift) ->
  -%%    (Byte bsl Shift) bor decode_integer_pos(Tail, Shift-8);
  -%%decode_integer_pos([], _) -> 0.
  -
  -
  -%%decode_integer_neg([Byte|Tail], Shift) ->
  -%%    (-128 + (Byte band 127) bsl Shift) bor decode_integer_pos(Tail, Shift-8).
  -
  -
  -concat_bit_binaries([],Bin={_,_}) ->
  -    Bin;
  -concat_bit_binaries({0,B1},{U2,B2}) ->
  -    {U2,<<B1/binary,B2/binary>>};
  -concat_bit_binaries({U1,B1},{U2,B2}) ->
  -    S1 = (size(B1) * 8) - U1,
  -    S2 = (size(B2) * 8) - U2,
  -    PadBits = 8 - ((S1+S2) rem 8),
  -    {PadBits, <<B1:S1/binary-unit:1,B2:S2/binary-unit:1,0:PadBits>>};
  -concat_bit_binaries(L1,L2) when is_list(L1), is_list(L2) ->
  -    %% this case occur when decoding with NNL
  -    L1 ++ L2.
  -
  -
  -get_constraint(C,Key) ->
  -    case lists:keyfind(Key,1,C) of
  -	false ->
  -	     no;
  -	{_, V} ->
  -	    V
  -    end.
  -
  -%%skip(Buffer, 0) ->
  -%%    Buffer;
  -%%skip([H | T], Len) ->
  -%%    skip(T, Len-1).
   
   new_tags([],LastTag) ->
       [LastTag];
  
positive.code: %%          [<127]| [128 + Int (<127),OctetList] | [16#80]
  %%============================================================================
  
  encode_length(indefinite) ->
      {[16#80],1}; % 128
  encode_length(L) when L =< 16#7F ->
      {[L],1};
  encode_length(L) ->
  
negative.code: %%
  -module(asn1rt_ber_bin).
  
  -export([decode_length/1,
  	 encode_real/2, encode_real/3,
  	 decode_real/2, decode_real/4,
  	 decode_tag/1]).
  
  -include("asn1_records.hrl").
  
  %% the encoding of class of tag bits 8 and 7
  -define(UNIVERSAL,   0).
  
  %%% primitive or constructed encoding % bit 6
  -define(PRIMITIVE,   0).
  -define(CONSTRUCTED, 2#00100000).
  
  %%% The tag-number for universal types
  -define(N_REAL, 9).
  
  encode_tag_val({Class, Form, TagNo}) when (TagNo =< 30) ->
      <<(Class bsr 6):2,(Form bsr 5):1,TagNo:5>>;
  
  encode_tag_val({Class, Form, TagNo}) ->
      {Octets,_Len} = mk_object_val(TagNo),
      BinOct = list_to_binary(Octets),
      <<(Class bsr 6):2, (Form bsr 5):1, 31:5,BinOct/binary>>.
  
  %%===============================================================================
  %% Decode a tag
  