Assuming that the value you want to clear the bits is of an unsigned type and not a "low rank", this is the safest and most portable way to clear the lower 16 bits:
b &= -0x10000;
The value -0x10000 will be assigned to type b (unsigned type) using modular arithmetic, as a result of which all high bits will be set, and the lower 16 bits will be zero.
Edit: Actually, James's answer is the safest (the widest possible use cases) for everyone, but the way his answer and mine generalize to other similar problems is slightly different, and mine may be more applicable in related problems.
source share