[Piglit] [PATCH piglit v2] teximage-color: Fix un_to_float for 32-bit builds

Neil Roberts neil at linux.intel.com
Wed Sep 17 09:42:19 PDT 2014

Hi Ken,

Ken Phillis Jr <kphillisjr at gmail.com> writes:

>> -       unsigned int max = ~(~0ul << bits);
>> +       unsigned int max = ~0u >> (sizeof max * 8 - bits);
> why not use, sizeof(unsigned int)? the call "sizeof max" may not always
> work depending on compiler

Could you explain which compilers “sizeof max” wouldn't work on and why?
I think it's nicer to avoid duplicating the type name if possible and
this seems like pretty standard C.

- Neil

More information about the Piglit mailing list