• Martin Storsjo's avatar
    Avoid casting arbitrary values to an enum · c8002b04
    Martin Storsjo authored
    The enum only contains the constant values 0, 1 and 2. This produces
    the warning "comparison of constant 6 with expression of type
    'PS_RESOLUTION' is always false" in clang for the first check
    in the getNoBands function (but apparently not for the second one
    even though mode>=3 shouldn't ever happen for a valid PS_RESOLUTION
    value either). This could allow the compiler to completely remove
    the conditions that shouldn't be able to occur even though they
    actually are used and are necessary.
    
    By passing the value as UINT instead, it is clear to the compiler
    that all the checks are necessary.
    c8002b04
ps_bitenc.cpp 23.1 KB