anchor.diff:  merge_warns({ok, M, B}, Warns, binary)           -> {ok, M, B, Warns};
   merge_warns({ok, M, B, Warns1}, Warns2, binary)  -> {ok, M, B, Warns2++Warns1};
   merge_warns({error, R}, Warns, _OutFmt)          -> {error, R, Warns};
  -merge_warns({error, R, Warns1}, Warns2, _OutFmt) -> {error, R, Warns2++Warns1}.
  +merge_warns({error, R, Warns1}, Warns2, _OutFmt) -> {error, R, Warns2++Warns1};
  +merge_warns(error, Warns, binary) ->
  +    erlang:error({internal_error, generated_code_failed_to_compile, Warns}).
   
   possibly_report_warnings(Result, Opts) ->
       Warns = case Result of
  
positive.code:      f("    NewMsg = ~p(Value, Msg),~n", [mk_fn(add_field_, MsgName, FName)]),
       f("    ~p(Rest, 0, 0, NewMsg).~n",
         [mk_fn(d_read_field_def_, MsgName)])].
  
  format_packed_field_seq_decoder(MsgName, #field{type=Type}=FieldDef, Opts) ->
      case Type of
          fixed32  -> format_dpacked_nonvi(MsgName, FieldDef, 32, 'little');
          sfixed32 -> format_dpacked_nonvi(MsgName, FieldDef, 32, 'little-signed');
          float    -> format_dpacked_nonvi(MsgName, FieldDef, 32, 'little-float');
          fixed64  -> format_dpacked_nonvi(MsgName, FieldDef, 64, 'little');
          sfixed64 -> format_dpacked_nonvi(MsgName, FieldDef, 64, 'little-signed');
          double   -> format_dpacked_nonvi(MsgName, FieldDef, 64, 'little-float');
          _        -> format_dpacked_vi(MsgName, FieldDef, Opts)
      end.
  
  format_dpacked_nonvi(MsgName, #field{name=FName}, BitLen, BitType) ->
      FnName = mk_fn(d_packed_field_, MsgName, FName),
      [f("~p(<<Value:~p/~s, Rest/binary>>, AccSeq) ->~n",
         [FnName, BitLen, BitType]),
       f("    ~p(Rest, [Value | AccSeq]);~n", [FnName]),
       f("~p(<<>>, AccSeq) ->~n", [FnName]),
       f("    AccSeq.~n")].
  
  format_dpacked_vi(MsgName, #field{name=FName, type=Type}, Opts) ->
      FnName = mk_fn(d_packed_field_, MsgName, FName),
      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, AccSeq) ->~n", [FnName]),
       f("    ~p(Rest, N+7, X bsl N + Acc, AccSeq);~n", [FnName]),
       f("~p(<<0:1, X:7, Rest/binary>>, N, Acc, AccSeq) ->~n", [FnName]),
       f("~s", [FValueCode]),
       f("    ~p(~s, 0, 0, [FValue | AccSeq]);~n", [FnName, RestVar]),
       f("~p(<<>>, 0, 0, AccSeq) ->~n", [FnName]),
       f("    AccSeq.~n~n")].
  
  format_msg_decoder_reverse_toplevel(MsgName, MsgDef, AnRes) ->
      case get_field_pass(MsgName, AnRes) of
  
negative.code:         replace_tree('<Res>', ResVar),
          replace_tree('<Value>', ValueExpr)]).
  
  format_uf32_field_decoder(MsgName, FieldDef, AnRes) ->
      format_f_field_decoder(MsgName, 32, 'little', FieldDef, AnRes).
  
  