While this will silence the warning, it isn't really the right fix.

Here `U` can be any unsigned integer type, and when `sizeof(U) > sizeof(unsigned int)` (for example, when `U` is `unsigned long long` on most platforms), then it will silently chop off the upper bits of the value, which is really bad.

We could cast to the widest unsigned type the compiler supports (though that's not always easy to automatically determine) but that risks the compiler actually using that wide type even when U is narrower, and types wider than the machine word size are often less efficient.

A better fix is to provide a "template specialisation" for the case when U is bool, and then the non-specialised version here will only get used for types which can represent a value above 128.  Then we won't get the warning, or risk making the code less efficient for some types.