[FFmpeg-devel] [RFC] "Likely" and "Unlikely" macros

Ramiro Polla ramiro.polla
Tue Oct 7 23:07:30 CEST 2008

On Tue, Oct 7, 2008 at 6:03 PM, Jason Garrett-Glaser
<darkshikari at gmail.com> wrote:
> The following macros seem to provide great benefit in some critical
> code sections, such as decode_cabac_residual, where I've shaved off a
> few clocks experimenting with them:
> #define likely(x) __builtin_expect((x),1)
> #define unlikely(x) __builtin_expect((x),0)
> This is probably due to gcc knowing which side of each if statement to inline.
> Is there any objection to using these in various critical code
> sections in ffmpeg?


I just don't know the internals enough to try and shave cycles out of
critical sections =)

More information about the ffmpeg-devel mailing list