Use `shift` instead of `shiftL` and `shiftR` to avoid undefined behaviour