anchor.diff:       f("    ~p(Rest2, 0, 0, NewMsg).~n~n", [mk_fn(d_read_field_def_, MsgName)]),
        format_packed_field_seq_decoder(MsgName, FieldDef, Opts)].
   
  -format_vi_based_field_decoder(MsgName, #field{type=Type, name=FName}, Opts) ->
  +format_vi_based_field_decoder(MsgName, FieldDef, NF, Opts) when NF =< 250 ->
  +    #field{type=Type, rnum=RNum, name=FName}=FieldDef,
  +    Merge = classify_field_merge_action(FieldDef),
  +    PassFieldVars = [[", ", f("F~w", [I])] || I <- lists:seq(1, NF)],
  +    InFieldVars = [[", ", if I == RNum-1, Merge == overwrite -> "_";
  +                             I == RNum-1, Merge == seqadd    -> f("F~w", [I]);
  +                             I == RNum-1, Merge == msgmerge  -> f("F~w", [I]);
  +                             I /= RNum-1                     -> f("F~w", [I])
  +                          end]
  +                   || I <- lists:seq(1, NF)],
  +    MergeCode = case Merge of
  +                    overwrite -> "";
  +                    seqadd    -> f("    FValue2 = [FValue | F~w],~n", [RNum-1]);
  +                    msgmerge  -> {msg,FMsgName} = Type,
  +                                 f("    FValue2 = if F~w == undefined ->~n"
  +                                   "                     FValue;~n"
  +                                   "                 true ->~n"
  +                                   "                     ~p(F~w, FValue)~n"
  +                                   "              end,~n",
  +                                   [RNum-1,
  +                                    mk_fn(merge_msg_, FMsgName), RNum-1])
  +                end,
  +    OutFieldVars = [[", ", if I == RNum-1, Merge == overwrite -> "FValue";
  +                              I == RNum-1, Merge == seqadd    -> "FValue2";
  +                              I == RNum-1, Merge == msgmerge  -> "FValue2";
  +                              I /= RNum-1                     -> f("F~w", [I])
  +                           end]
  +                    || I <- lists:seq(1, NF)],
  +    BValueExpr = "X bsl N + Acc",
  +    {FValueCode, RestVar} = mk_unpack_vi(4, "FValue", BValueExpr, Type, "Rest",
  +                                         Opts),
  +    [f("~p(<<1:1, X:7, Rest/binary>>, N, Acc~s) ->~n"
  +       "    ~p(Rest, N+7, X bsl N + Acc~s);~n",
  +       [mk_fn(d_field_, MsgName, FName), PassFieldVars,
  +        mk_fn(d_field_, MsgName, FName), PassFieldVars]),
  +     f("~p(<<0:1, X:7, Rest/binary>>, N, Acc~s) ->~n",
  +       [mk_fn(d_field_, MsgName, FName), InFieldVars]),
  +     f("~s",
  +       [FValueCode]),
  +     f("~s",
  +       [MergeCode]),
  +     f("    ~p(~s, 0, 0~s).~n",
  +       [mk_fn(d_read_field_def_, MsgName), RestVar, OutFieldVars])];
  +format_vi_based_field_decoder(MsgName, FieldDef, NF, Opts) when NF > 250 ->
  +    #field{type=Type, name=FName}=FieldDef,
       BValueExpr = "X bsl N + Acc",
       {FValueCode, RestVar} = mk_unpack_vi(4, "FValue", BValueExpr, Type, "Rest",
                                            Opts),
  
positive.code:      f("    <<PackedBytes:Len/binary, Rest2/binary>> = Rest,~n"),
       f("    NewSeq = ~p(PackedBytes~sAccSeq),~n",
         [mk_fn(d_packed_field_, MsgName, FName),
          case mk_field_decoder_vi_params(FieldDefAsNonpacked) of
              ""     -> [", "];
              Params -> [", ", Params, ", "]
          end]),
  
negative.code:      indent(Indent,f("   true -> -((~s + 1) bsr 1)~n", [VarStr])),
       indent(Indent,f("end"))].
  
  format_uf32_field_decoder(MsgName, FieldDef, NF) ->
      format_f_field_decoder(MsgName, 32, 'little', FieldDef, NF).
  
  format_sf32_field_decoder(MsgName, FieldDef, NF) ->
      format_f_field_decoder(MsgName, 32, 'little-signed', FieldDef, NF).
  
  format_float_field_decoder(MsgName, FieldDef, NF) ->
      format_f_field_decoder(MsgName, 32, 'little-float', FieldDef, NF).
  
  format_uf64_field_decoder(MsgName, FieldDef, NF) ->
      format_f_field_decoder(MsgName, 64, 'little', FieldDef, NF).
  
  format_sf64_field_decoder(MsgName, FieldDef, NF) ->
      format_f_field_decoder(MsgName, 64, 'little-signed', FieldDef, NF).
  
  format_double_field_decoder(MsgName, FieldDef, NF) ->
      format_f_field_decoder(MsgName, 64, 'little-float', FieldDef, NF).
  
  format_f_field_decoder(MsgName, BitLen, BitType, FieldDef, NF) when NF =< 250 ->
      #field{rnum=RNum, name=FName}=FieldDef,
      Merge = classify_field_merge_action(FieldDef),
      InFieldVars = [[", ", if I == RNum-1, Merge == overwrite -> "_";
                               I == RNum-1, Merge == seqadd    -> f("F~w", [I]);
                               I /= RNum-1                     -> f("F~w", [I])
                            end]
                     || I <- lists:seq(1, NF)],
      MergeCode = case Merge of
                      overwrite -> "";
                      seqadd    -> f("    Value2 = [Value | F~w],~n", [RNum-1])
                  end,
      OutFieldVars = [[", ", if I == RNum-1, Merge == overwrite -> "Value";
                                I == RNum-1, Merge == seqadd    -> "Value2";
                                I /= RNum-1                     -> f("F~w", [I])
                             end]
                      || I <- lists:seq(1, NF)],
  
      [f("~p(<<Value:~p/~s, Rest/binary>>, _, _~s) ->~n",
         [mk_fn(d_field_, MsgName, FName), BitLen, BitType, InFieldVars]),
       f("~s", [MergeCode]),
       f("    ~p(Rest, 0, 0~s).~n",
         [mk_fn(d_read_field_def_, MsgName), OutFieldVars])];
  format_f_field_decoder(MsgName, BitLen, BitType, FieldDef, NF) when NF > 250 ->
      #field{name=FName}=FieldDef,
      [f("~p(<<Value:~p/~s, Rest/binary>>, Msg) ->~n",
         [mk_fn(d_field_, MsgName, FName), BitLen, BitType]),
       f("    NewMsg = ~p(Value, Msg),~n", [mk_fn(add_field_, MsgName, FName)]),
  