Use bit masking to determine the number of bytes

It is more common to use bit masking instead of shifting to determine the
number of continuation bytes. It also does not rely on sign extension and
it is more clear than the previous bit shifts.