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