MAINT: refactor packbits/unpackbits

Pushes the GIL release one loop outward.
Could use a mask here, but might not be as obvious as mod 8.