Clang 10 reports a compilation warning: > wtf/MathExtras.h(401,43): warning: implicit conversion from 'unsigned long long' to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Wimplicit-int-float-conversion] > double fmodValue = fmod(trunc(d), std::numeric_limits<unsigned long long>::max() + 1.0); doubleToInteger was added in Bug 67980.
More warnings: > [20/129] Building CXX object Source\WTF\wtf\CMakeFiles\WTF.dir\MediaTime.cpp.obj > ..\..\Source\WTF\wtf\MediaTime.cpp(117,21): warning: implicit conversion from 'long long' to 'float' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-int-float-conversion] > if (floatTime > std::numeric_limits<int64_t>::max()) > ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ..\..\Source\WTF\wtf\MediaTime.cpp(124,36): warning: implicit conversion from 'long long' to 'float' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-int-float-conversion] > while (floatTime * timeScale > std::numeric_limits<int64_t>::max()) > ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ..\..\Source\WTF\wtf\MediaTime.cpp(147,22): warning: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-int-float-conversion] > if (doubleTime > std::numeric_limits<int64_t>::max()) > ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > ..\..\Source\WTF\wtf\MediaTime.cpp(154,37): warning: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-int-float-conversion] > while (doubleTime * timeScale > std::numeric_limits<int64_t>::max()) > ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 4 warnings generated.
Created attachment 384784 [details] WIP patch
Umm, there are more. Here is full compilation log after applying the WIP patch. https://gist.github.com/fujii/160ae6e66138d6b48dc4e342f58837b6
https://bugzilla.mozilla.org/show_bug.cgi?id=1577236 Here's Mozilla's work to fix this warning in their codebase
Created attachment 395215 [details] Patch
Comment on attachment 395215 [details] Patch We don’t use typically function style casts in WebKit. We should look for other ways to do the conversion. These warnings suggest there are mistakes in some of these places. I am not sure that just quieting the warning without a behavior change is good.
https://stackoverflow.com/a/17822304 This is interesting. They uses an idea using ldexp which is similar approach with my WIP patch (comment 2).
Filed: Bug 209955 – [Clang 10] Fix -Wimplicit-int-float-conversion compilation warnings in WTF