MAINT: refactor packbits/unpackbits

Pushes the GIL release one loop outward.
I confess this looks strange to me, why put the bits in the high end? Everything else shifts in from the right. I wonder why it was done this way?