[Mesa-dev] [PATCH] swr: Templetize std::max to work on windows

Ilia Mirkin imirkin at alum.mit.edu
Tue Nov 29 20:40:21 UTC 2016


On Tue, Nov 29, 2016 at 2:59 PM, Kyriazis, George
<george.kyriazis at intel.com> wrote:
>
>> -----Original Message-----
>> From: ibmirkin at gmail.com [mailto:ibmirkin at gmail.com] On Behalf Of Ilia
>> Mirkin
>> Sent: Tuesday, November 29, 2016 1:54 PM
>> To: Kyriazis, George <george.kyriazis at intel.com>
>> Cc: mesa-dev at lists.freedesktop.org
>> Subject: Re: [Mesa-dev] [PATCH] swr: Templetize std::max to work on
>> windows
>>
>> How about just making 'layers' unsigned? (Hm, I wonder why this didn't
>> trigger issues with gcc... maybe it should be +1u instead of +1?)
>>
> Could do that, too, but there are other places in our code that use templetized versions of std::max.
>
> I guess gcc prioritizes implicit casts...  +1u does not help, since the last_layer/first_layer fields are already unsigned.  It's the int vs unsigned type mismatch that caused the issue.

OK. I'll let Tim/Bruce rule on this... my personal preference would be
to change the type of layers or switch to the MAX2() macro, but it's
been a while since I've done serious C++. If you do end up adding an
explicit type, maybe also adjust the next line's alignment so that it
matches up as it currently does.

Cheers,

  -ilia


More information about the mesa-dev mailing list