bitv: Avoid undefined behavior in mask_for_bits

It was relying on the fact that x86 shifts are effectively %BITS, so
shifting a u32 by 32 preserves all bits.  But this is undefined behavior
in general.  Add an explicit %BITS to be safe.
Actually, is it not the case that the internal `%` can be removed completely because *math*?

That is `(x - (y mod j)) mod j == (x - y) mod (some multiple of j, because uints wrap) mod j`