indexcodec: Add bounds checks to index sequence encoder
indexcodec: Add bounds checks to index sequence encoder

This requires us to add a 4-byte tail so that we can decode without
internal bounds checks. The tail isn't used for anything right now.

Also add comments to encode/decode and make sure the structure mostly
matches.

zeux/meshoptimizer,zeux/meshoptimizer,zeux/meshoptimizer