Revision 65db0587 libavutil/mathematics.c

View differences:

libavutil/mathematics.c
144 144
    return 0;
145 145
}
146 146

  
147
int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod){
148
    int64_t c= (a-b) & (mod-1);
149
    if(c > (mod>>1))
150
        c-= mod;
151
    return c;
152
}
153

  
147 154
#ifdef TEST
148 155
#include "integer.h"
149 156
#undef printf

Also available in: Unified diff