How to do bit-indexing when compacting variously sized inputs.If you need to make compact data from various inputs here is an example: