[FFmpeg-devel] [PATCH] all: simplify qsort comparators, and add const-correctness

Nicolas George george at nsup.org
Sun Oct 25 16:12:55 CET 2015

Le quartidi 4 brumaire, an CCXXIV, Ganesh Ajjanagadde a écrit :
> Seems like the (x > y) - (x < y) trick works very well: GCC optimizes
> it to branch-less code, and it is overflow safe:
> https://stackoverflow.com/questions/10996418/efficient-integer-compare-function/10997428#10997428
> Will submit patch to convert all qsort comparators (the ones for
> integers) to this form, yielding two benefits:

Nice. Maybe make it a macro: AV_DIFFSIGN(x, y).


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151025/d2e4fe77/attachment.sig>

More information about the ffmpeg-devel mailing list