add a TODO: we could read a byte at a time while bits >= 8, and that would be faster.