Brian Paul <bri...@vmware.com> writes:

> On 10/08/2013 11:36 AM, Eric Anholt wrote:
>> We hadn't run into order of operation warnings before, apparently, since
>> addition is so low on the order.
>>
>> Cc: "9.1 9.2" <mesa-sta...@lists.freedesktop.org>
>> ---
>>   src/mesa/main/macros.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
>> index 1052f75..05aad4e 100644
>> --- a/src/mesa/main/macros.h
>> +++ b/src/mesa/main/macros.h
>> @@ -673,7 +673,7 @@ minify(unsigned value, unsigned levels)
>>    *
>>    * \sa ROUND_DOWN_TO()
>>    */
>> -#define ALIGN(value, alignment)  (((value) + alignment - 1) & ~(alignment - 
>> 1))
>> +#define ALIGN(value, alignment)  (((value) + (alignment) - 1) & 
>> ~((alignment) - 1))
>
> Reviewed-by: Brian Paul <bri...@vmware.com>
>
> If we're usually using unsigned variables, maybe this should be an 
> inline function.

It's nice to be able to use align on both a uint64_t and uint32_t
without worrying about type conversions happening.  (I haven't looked
into what the compiler would do if we had it always u64)

Attachment: pgp2rWzrlUDmR.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to