[FFmpeg-cvslog] avutil: add divide & modulo that round like unsigned ones do that is down.

Michael Niedermayer git at videolan.org
Mon May 9 19:58:00 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon May  9 17:47:22 2011 +0200| [51927883213dfe9e8469f5d3c21ef041eb1f7236] | committer: Michael Niedermayer

avutil: add divide & modulo that round like unsigned ones do that is down.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=51927883213dfe9e8469f5d3c21ef041eb1f7236
---

 libavutil/common.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavutil/common.h b/libavutil/common.h
index 5814297..493c313 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)
 



More information about the ffmpeg-cvslog mailing list