[Mesa-dev] [PATCH 1/3] vl: Only initialize vlc once

Maarten Lankhorst m.b.lankhorst at gmail.com
Wed Dec 21 07:31:13 PST 2011


Hey Christian,

On 12/20/2011 09:08 PM, Lucas Stach wrote:
> Hi all!
> Just jumping in with regard to the assert.
>
> Am Dienstag, den 20.12.2011, 19:20 +0100 schrieb Maarten Lankhorst:
> [snip]
>>>>      return vlc->buffer>>  (64 - num_bits);
>>>>   }
>>>> @@ -130,7 +132,7 @@ vl_vlc_peekbits(struct vl_vlc *vlc, unsigned num_bits)
>>>>   static INLINE void
>>>>   vl_vlc_eatbits(struct vl_vlc *vlc, unsigned num_bits)
>>>>   {
>>>> -   //assert(vlc->valid_bits>  num_bits);
>>>> +   assert(vlc->valid_bits>= num_bits);
>>> Just commenting in all checks isn't such a good idea, since that affect performance very badly, a define which enables all assertions at once at the beginning of the file seems the better idea.
>> Sure.
> Please don't define your own semantic for this checks. Assert is only
> used in debug builds and there it shouldn't matter how it affects
> performance. In release builds assert is typically a no-op and therefore
> optimized away, but it could also be used to help the compiler optimize
> for the asserted conditions.
> Asserts should be never deactivated with code defines.
>
With my explanation for the changes and this, do you still want me to update this patch or would it be ok to apply as is?

~Maarten


More information about the mesa-dev mailing list