From 51927883213dfe9e8469f5d3c21ef041eb1f7236 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 9 May 2011 17:47:22 +0200 Subject: [PATCH] avutil: add divide & modulo that round like unsigned ones do that is down. Signed-off-by: Michael Niedermayer --- libavutil/common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavutil/common.h b/libavutil/common.h index 5814297cf2..493c3139aa 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -47,6 +47,8 @@ #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) /* assume b>0 */ #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) +#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 FFSIGN(a) ((a) > 0 ? 1 : -1)