summaryrefslogtreecommitdiff
path: root/libavutil/common.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-05-09 17:47:22 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-05-09 17:47:22 +0200
commit51927883213dfe9e8469f5d3c21ef041eb1f7236 (patch)
tree35df5da74098439d7c840a417d21013c2bd43d9f /libavutil/common.h
parent5deedf3552819e5bea3327a450155bb57643a999 (diff)
downloadffmpeg-51927883213dfe9e8469f5d3c21ef041eb1f7236.tar.gz
avutil: add divide & modulo that round like unsigned ones do that is down.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/common.h')
-rw-r--r--libavutil/common.h2
1 files changed, 2 insertions, 0 deletions
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)