MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / av_mod_i

Function av_mod_i

libavutil/integer.c:108–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b){
109 int i= av_log2_i(a) - av_log2_i(b);
110 AVInteger quot_temp;
111 if(!quot) quot = &quot_temp;
112
113 assert((int16_t)a[AV_INTEGER_SIZE-1] >= 0 && (int16_t)b[AV_INTEGER_SIZE-1] >= 0);
114 assert(av_log2(b)>=0);
115
116 if(i > 0)
117 b= av_shr_i(b, -i);
118
119 memset(quot, 0, sizeof(AVInteger));
120
121 while(i-- >= 0){
122 *quot= av_shr_i(*quot, -1);
123 if(av_cmp_i(a, b) >= 0){
124 a= av_sub_i(a, b);
125 quot->v[0] += 1;
126 }
127 b= av_shr_i(b, 1);
128 }
129 return a;
130}
131
132AVInteger av_div_i(AVInteger a, AVInteger b){
133 AVInteger quot;

Callers 1

av_div_iFunction · 0.85

Calls 4

av_log2_iFunction · 0.85
av_shr_iFunction · 0.85
av_cmp_iFunction · 0.85
av_sub_iFunction · 0.85

Tested by

no test coverage detected