We just want to create a bitmask here, so cast the mask to unsigned to avoid left shifting a negative value which is undefined behavior.