FFUABSDIFF(a,b) returns |a-b|. It is designed to guarantee the correct result for unsigned operands a and b, while with integer operands overflow may occur depending on how it is used. This macro is useful across at least 3 places in the codebase, and is therefore placed in avutil/common.
Signed-off-by: Ganesh Ajjanagadde <gajjanaga...@gmail.com> --- libavutil/common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libavutil/common.h b/libavutil/common.h index 3e62b6d..eab7ed2 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -59,6 +59,7 @@ #define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b)) #define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b)) #define FFABS(a) ((a) >= 0 ? (a) : (-(a))) +#define FFUABSDIFF(a,b) (((a) > (b)) ? ((a)-(b)) : ((b)-(a))) #define FFSIGN(a) ((a) > 0 ? 1 : -1) #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) -- 2.5.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel