Speed up repack_bytes.