[Mesa-dev] [PATCH 1/3] vl: Only initialize vlc once
Lucas Stach
dev at lynxeye.de
Tue Dec 20 12:08:04 PST 2011
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.
-- Lucas
More information about the mesa-dev
mailing list