scary warning about casts

Riccardo Mottola <[email protected]> Fri, 26 Nov 2021 12:22:42 +0100
Newsgroups gmane.comp.lib.gnustep.devel
Message-ID <[email protected]>
Hello

I noticed I get these warnings, which look a bit scary.

 Compiling file XGServerWindow.m ...
XGServerWindow.m:3960:40: warning: implicit conversion from 'unsigned
int' to 'float' changes value from 4294967295 to
      4294967296 [-Wimplicit-int-float-conversion]
      opacity = (unsigned int)(alpha * 0xffffffffU);
                                     ~ ^~~~~~~~~~~
XGServerWindow.m:3996:31: warning: implicit conversion from 'unsigned
int' to 'float' changes value from 4294967295 to
      4294967296 [-Wimplicit-int-float-conversion]
        alpha = (float)*num / 0xffffffffU;


I think the warning is legit: alpha is float and is multiplied with an
explicit unsigned constant 0xffffffffU.

What is the code trying to achieve here?

Riccardo