avutil/common: add FFDIFFSIGN macro

Multimedia / FFmpeg - Ganesh Ajjanagadde [gmail.com] - 3 November 2015 15:28 UTC

This is of use for defining comparator callbacks. Common approaches like return x-y are not safe due to the risks of overflow. Furthermore, the (x > y) - (x < y) trick is optimized to branchless code. This also documents this macro accordingly.

265f83f avutil/common: add FFDIFFSIGN macro
libavutil/common.h | 11 +++++++++++
1 file changed, 11 insertions(+)

  • Share