MTBUF implementation has many issues and this change addresses most of these:
- refactored duplicated code;
- hardcoded constants moved out of high-level code;
- fixed a decoding error when nfmt or dfmt are zero (bug 36932);
- corrected parsing of operand separators (bug 46403);
- corrected handling of missing operands (bug 46404);
- corrected handling of out-of-range modifiers (bug 46421);
- corrected default value (bug 46467).
MTBUF implementation was actually rewritten from scratch so I'm not sure if these changes should be submitted separately from each other.
There is one remaining issue: current MTBUF syntax is not compatible with SP3. SP3 syntax support will be added by a separate change.
gcc (7.4.0) warns here about
It can be silenced with e.g.