Don't cast -1 to enum to represent a missing value.

This is undefined behavior in C++, and a clang warning suggests it is
actually producing bad code as a result:

../Source/Core/VideoCommon/BPFunctions.cpp:164:45: warning: comparison of constant 4294967295 with expression of type 'PEControl::PixelFormat' is always false [-Wtautological-constant-out-of-range-compare]
        if (new_format == old_format || old_format == (unsigned int)-1)
This commit is contained in:
comex
2014-03-27 23:52:27 -04:00
parent 9b8296d5ab
commit b5654a2464
3 changed files with 12 additions and 11 deletions

View File

@ -161,7 +161,7 @@ void OnPixelFormatChange()
auto new_format = bpmem.zcontrol.pixel_format;
// no need to reinterpret pixel data in these cases
if (new_format == old_format || old_format == (unsigned int)-1)
if (new_format == old_format || old_format == PEControl::INVALID_FMT)
goto skip;
// Check for pixel format changes