aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/mathematics.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-06-09 17:27:42 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-06-09 17:27:42 +0000
commit65db0587a8f3233afa67e870aac38c494314ebeb (patch)
tree937511ddce80d73e8c31b6cf91a0bf35255abcbb /libavutil/mathematics.c
parent130b096aea6e91cff4b608f9ef61e9c96e3166d1 (diff)
downloadffmpeg-65db0587a8f3233afa67e870aac38c494314ebeb.tar.gz
Add av_compare_mod()
Originally committed as revision 23551 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/mathematics.c')
-rw-r--r--libavutil/mathematics.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index c06cb16165..00b81f131e 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -144,6 +144,13 @@ int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){
return 0;
}
+int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod){
+ int64_t c= (a-b) & (mod-1);
+ if(c > (mod>>1))
+ c-= mod;
+ return c;
+}
+
#ifdef TEST
#include "integer.h"
#undef printf