MAINT: refactor packbits/unpackbits

Pushes the GIL release one loop outward.
This explanation isn't clear. It packs the boolean values of the input array elements into the bits of a char array. The boolean value of the input element is 0 if all of its bytes are zero, 1 otherwise.