for reading/writing arbitrary length of bits