Properly wrap around numBits when shifting