[Mesa-dev] [PATCH 01/20] mesa/format_utils: Fix a bug in one of the format helper functions

Samuel Iglesias Gonsálvez siglesias at igalia.com
Wed Nov 19 03:34:44 PST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 19/11/14 09:28, Michel Dänzer wrote:
> On 18.11.2014 17:43, Iago Toral Quiroga wrote:
>> From: Jason Ekstrand <jason.ekstrand at intel.com>
> 
> The commit short log (first line of the commit log) should at least say 'snorm_to_float' instead of 'one of the format helper functions'. It could probably have a more informative summary of what the change does as well.
> 
> 
>> ---
>>   src/mesa/main/format_utils.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/main/format_utils.c b/src/mesa/main/format_utils.c
>> index 93a0cea..b6d0fbc 100644
>> --- a/src/mesa/main/format_utils.c
>> +++ b/src/mesa/main/format_utils.c
>> @@ -152,7 +152,7 @@ unorm_to_float(unsigned x, unsigned src_bits)
>>   static inline float
>>   snorm_to_float(int x, unsigned src_bits)
>>   {
>> -   if (x == -MAX_INT(src_bits))
>> +   if (x < -MAX_INT(src_bits))
>>         return -1.0f;
>>      else
>>         return x * (1.0f / (float)MAX_INT(src_bits));
> 
> Should it be if (x <= -MAX_INT(src_bits))? Even if the else case
> is guaranteed to produce -1.0f for x == -MAX_INT(src_bits), it seems like wasted effort.
> 
> 

Agreed, I will fix that when creating the second version of the series.

Thanks,

Sam
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJUbIBUAAoJEH/0ujLxfcNDDQMQALY4nST/oPsMfAh4NFJxFyvC
7YQf9OGYbrRVj797I4M6w/IjMrmXa1kz4OabQD7QWQvCq4d0DlHDqlKLQ71Gx7s0
rBW4pQo//x7sJNkzr4l84COz8rIt/WjYbOtD8qABX6WsRlcCQORf++w8G/RAtx9l
aCSIt5S4y20KZFc73FjhEjUMC4RMwmsxOJovA7FA/hGZtPrIRKCYwbg7EU/01THw
J3NAOPA8OCzPD0oYXBoV/PkXAzUh2s7RFKx/EFeuyHFVgFJmk9yxVImce3s4Cusf
pi6IooQBFcmhqv7GkNDcSU+e2ZFqMMSqXhnrmLaH5jvrqsvDTXsjVlDdCeXMQHwH
5p2QW+RSNwpT2QNBGy73BaqXXhj5ub1KGWHMq3ZVC4yXTVxV3P31vSoG6Lwz+B4J
KFAeBatwXDmmbo9Suk/HnpfB66rNOMmz4fJmzODI4cxArGmtjbpcKTEslorz0hnw
ptP5UVydjaWQK9cCV8QYSJlIZTBswKuC3GBvydUDH5KsS8s6Ki+StPvSDF7rClop
b4j9FrHWqoO1A7kfy+wTDxev34Py+R5ZBqzccjxcaFbPbhkCzg9Lq4hdOdovxKZQ
I+yNMXJWD4hEpZZJR9TOLK7e67EiVe2ObhScX0LZLuuaL9YID58CLaptpCsgI3uf
gNdeMDtzbkkXI2YbPtAr
=LWOR
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list