Add some bit interleaving/extraction functions

These will be used in the graphics stuff