246{
247 Int offset, j0, j1, templatewidth0, templatewidth1, nbcol0, nbcol1;
249 assert(type == 'c' || type == 'r');
250 nbcol0 = (type ==
'c' ? ma->
nbcol : ma->
nbrow);
251 nbcol1 = (type ==
'c' ? mb->
nbcol : mb->
nbrow);
252 templatewidth0 = q0 * nbcol0;
253 templatewidth1 = q1 * nbcol1;
254 {
257 j0 =
SHIFT(col0, sp0, q0) * nbcol0 - ja;
258 j1 =
SHIFT(col1, sp1, q1) * nbcol1 - jb;
259 }
260 offset = 0;
261 l = 0;
262
263
264
265 assert(j0 + nbcol0 > 0);
266 assert(j1 + nbcol1 > 0);
267 while ((j0 < n) && (j1 < n)) {
270 end0 = j0 + nbcol0;
271 end1 = j1 + nbcol1;
272 if (end0 <= j1) {
273 j0 += templatewidth0;
274 l += nbcol0;
275 continue;
276 }
277 if (end1 <= j0) {
278 j1 += templatewidth1;
279 continue;
280 }
281
283 start =
max(start, 0);
284
285 result[offset].
gstart = start;
286 end =
min(end0, end1);
287 if (end0 == end) {
288 j0 += templatewidth0;
289 l += nbcol0;
290 }
291 if (end1 == end)
292 j1 += templatewidth1;
293
295 assert(end > start);
296
297
298
299
300
301
302 result[offset].
len = end - start;
303 offset += 1;
304 }
305 return offset;
306}
#define SHIFT(row, sprow, nbrow)