Commit 42798529 by David 'Digit' Turner Committed by David Turner

[OpenGL] Fix implicit int-to-float-conversion compiler warning.

This CL fixes a minor compiler warning related to the use of 0xFFFFFFFF to divide a float value. It turns out that this integer value cannot be converted to a float without losing one bit of accuracy. Bug: None Change-Id: I34fefd91afb526edbfafd3d8a2378fa6b7bf325d Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/38448Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Tested-by: 's avatarDavid Turner <digit@google.com> Kokoro-Presubmit: David Turner <digit@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent d34bb293
...@@ -940,7 +940,10 @@ namespace egl ...@@ -940,7 +940,10 @@ namespace egl
for(int x = 0; x < width; x++) for(int x = 0; x < width; x++)
{ {
destF[x] = (float)sourceD32[x] / 0xFFFFFFFF; // NOTE: Second (float) cast is required to avoid compiler warning:
// error: implicit conversion from 'unsigned int' to 'float' changes value from
// 4294967295 to 4294967296 [-Werror,-Wimplicit-int-float-conversion]
destF[x] = (float)sourceD32[x] / (float)0xFFFFFFFF;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment