[Mesa-dev] [PATCH] mesa: Fix some -Wnarrowing warnings
Chad Versace
chad.versace at linux.intel.com
Fri Aug 10 09:55:58 PDT 2012
>> diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
>> index f743ce1..aefd412 100644
>> --- a/src/mesa/main/ff_fragment_shader.cpp
>> +++ b/src/mesa/main/ff_fragment_shader.cpp
>> @@ -890,10 +890,10 @@ emit_texenv(struct texenv_fragment_program *p, GLuint unit)
>> }
>> else {
>> float const_data[4] = {
>> - 1 << rgb_shift,
>> - 1 << rgb_shift,
>> - 1 << rgb_shift,
>> - 1 << alpha_shift
>> + static_cast<float>(1 << rgb_shift),
>> + static_cast<float>(1 << rgb_shift),
>> + static_cast<float>(1 << rgb_shift),
>> + static_cast<float>(1 << alpha_shift)
>
> So, what's wrong with
> (float)(1 << rgb_shift)
> ?
In C++, I like to use the C++ cast functions. Just a style preference.
Anyways, this patch nakked and another is taking its place.
More information about the mesa-dev
mailing list