anchor.diff:      d(Rest, [{vi,0,0}, read_field], MsgDef, Defs, NewMsg);
   d(<<0:1, X:7, Rest/binary>>,
     [{vi,N,Acc}, {add_field,#field{type=int32}=FieldDef}], MsgDef, Defs, Msg) ->
  -    <<Value:32/signed>> = <<(X bsl (N*7) + Acc):32>>,
  -    NewMsg = add_field(Value, FieldDef, Defs, Msg),
  +    NewMsg = add_field(uint32_to_int32(X bsl (N*7) + Acc), FieldDef, Defs, Msg),
       d(Rest, [{vi,0,0}, read_field], MsgDef, Defs, NewMsg);
   d(<<0:1, X:7, Rest/binary>>,
     [{vi,N,Acc}, {add_field,#field{type=int64}=FieldDef}], MsgDef, Defs, Msg) ->
  -    <<Value:64/signed>> = <<(X bsl (N*7) + Acc):64>>,
  -    NewMsg = add_field(Value, FieldDef, Defs, Msg),
  +    NewMsg = add_field(uint64_to_int64(X bsl (N*7) + Acc), FieldDef, Defs, Msg),
       d(Rest, [{vi,0,0}, read_field], MsgDef, Defs, NewMsg);
   d(<<0:1, X:7, Rest/binary>>,
     [{vi,N,Acc}, {add_field,#field{type=uint32}=FieldDef}], MsgDef, Defs, Msg) ->
  
positive.code:     <<_:Length/binary, Rest2/binary>> = Rest,
      d(Rest2, [{vi,0,0},read_field], MsgDef, Defs, Msg).
  
  
  
  
  decode_field(Bin, MsgDef, MsgDefs, Msg) when byte_size(Bin) > 0 ->
      {Key, Rest} = decode_varint(Bin),
  
negative.code:                 bits32 ->
                      d(Rest, skip_bits_32, MsgDef, Defs, Msg)
              end;
          #field{type=Type, opts=Opts} = FieldDef ->
              Todo = case Type of
                         sint32   -> [{vi,0,0}, {add_field, FieldDef}];
                         sint64   -> [{vi,0,0}, {add_field, FieldDef}];
                         int32    -> [{vi,0,0}, {add_field, FieldDef}];
                         int64    -> [{vi,0,0}, {add_field, FieldDef}];
                         uint32   -> [{vi,0,0}, {add_field, FieldDef}];
                         uint64   -> [{vi,0,0}, {add_field, FieldDef}];
                         bool     -> [{vi,0,0}, {add_field, FieldDef}];
                         {enum,_} -> [{vi,0,0}, {add_field, FieldDef}];
                         fixed32  -> {add_field, FieldDef};
                         sfixed32 -> {add_field, FieldDef};
                         float    -> {add_field, FieldDef};
                         fixed64  -> {add_field, FieldDef};
                         sfixed64 -> {add_field, FieldDef};
                         double   -> {add_field, FieldDef};
                         string   -> [{vi,0,0},{add_field, FieldDef}];
                         bytes    -> [{vi,0,0},{add_field, FieldDef}];
                         {msg,_}  -> [{vi,0,0},{add_field, FieldDef}]
                     end,
              case proplists:get_bool(packed, Opts) of
                  true  ->
                      d(Rest, [{vi,0,0},{packed,FieldDef}],
                        MsgDef, Defs, Msg);
                  false ->
                      d(Rest, Todo, MsgDef, Defs, Msg)
              end
      end;
  d(<<0:1, X:7, Rest/binary>>,
    [{vi,N,Acc}, {packed, FieldDef}], MsgDef, Defs, Msg) ->
      Len = (X bsl (N*7) + Acc),
      <<PackedBytes:Len/binary, Rest2/binary>> = Rest,
      #field{type=Type, rnum=RNum} = FieldDef,
      AccSeq = element(RNum, Msg),
      NewSeq = case Type of
                   fixed32  -> dpfixed32(PackedBytes, AccSeq);
                   sfixed32 -> dpsfixed32(PackedBytes, AccSeq);
                   float    -> dpfloat(PackedBytes, AccSeq);
                   fixed64  -> dpfixed64(PackedBytes, AccSeq);
                   sfixed64 -> dpsfixed64(PackedBytes, AccSeq);
                   double   -> dpdouble(PackedBytes, AccSeq);
                   _        -> dpvi(PackedBytes, 0, 0, Type, AccSeq, Defs)
               end,
      NewMsg = setelement(RNum, Msg, NewSeq),
      d(Rest2, [{vi,0,0}, read_field], MsgDef, Defs, NewMsg);
  d(<<0:1, X:7, Rest/binary>>,
    [{vi,N,Acc}, {add_field,#field{type=sint32}=FieldDef}], MsgDef, Defs, Msg) ->
      Value = decode_zigzag(X bsl (N*7) + Acc),
  