No longer use generic approach for packing values

Instead of looping and shifting, just spell out each format directly, so
that the code is easier to link to the spec. Performance is also
significantly better.