@Override
    void pack(Info vi, Object imap, Buffer opb) {
        InfoMapping0 info = (InfoMapping0) imap;

        /* another 'we meant to do it this way' hack...  up to beta 4, we
         packed 4 binary zeros here to signify one submapping in use.  We
         now redefine that to mean four bitflags that indicate use of
         deeper features; bit0:submappings, bit1:coupling,
         bit2,3:reserved. This is backward compatable with all actual uses
         of the beta code. */
        if (info.submaps > 1) {
            opb.write(1, 1);
            opb.write(info.submaps - 1, 4);
        } else {
            opb.write(0, 1);
        }

        if (info.coupling_steps > 0) {
            opb.write(1, 1);
            opb.write(info.coupling_steps - 1, 8);
            for (int i = 0; i < info.coupling_steps; i++) {
                opb.write(info.coupling_mag[i], Util.ilog2(vi.channels));
                opb.write(info.coupling_ang[i], Util.ilog2(vi.channels));
            }
        } else {
            opb.write(0, 1);
        }

        opb.write(0, 2); /* 2,3:reserved */

        /* we don't write the channel submappings if we only have one... */
        if (info.submaps > 1) {
            for (int i = 0; i < vi.channels; i++) {
                opb.write(info.chmuxlist[i], 4);
            }
        }
        for (int i = 0; i < info.submaps; i++) {
            opb.write(info.timesubmap[i], 8);
            opb.write(info.floorsubmap[i], 8);
            opb.write(info.residuesubmap[i], 8);
        }
    }