bridge/class-master/depend/pari/src/basemath/qfisom.c
/* delete the elements in orb2 from orb1, an entry 0 marks the end of the
 * list, returns the length of orb1 */
delete the elements in orb2 from orb1, an entry 0 marks the end of the
list, returns the length of orb1
delete the elements in orb2 from orb1 an entry 0 marks the end of the list returns the length of orb1
static long
orbdelete(GEN orb1, GEN orb2)
{
  long i, j, len;
  long l1 = lg(orb1)-1;
  long l2 = lg(orb2)-1;
  for (i = 1; i <= l1  &&  orb1[i] != 0; ++i);
  len = i - 1;
  for (i = 1; i <= l2  &&  orb2[i] != 0; ++i)
  {
    long o2i = orb2[i];
    for (j = 1; j <= len  &&  orb1[j] != o2i; ++j);
    if (j <= len)
    {
      orb1[j] = orb1[len];
      orb1[len--] = 0;
    }
  }
  return len;
}
static long orbdelete ( GEN orb1 , GEN orb2 ) { long i , j , len ; long l1 = lg ( orb1 ) - 1 ; long l2 = lg ( orb2 ) - 1 ; for ( i = 1 ; i <= l1 && orb1 [ i ] != 0 ; ++ i ) ; len = i - 1 ; for ( i = 1 ; i <= l2 && orb2 [ i ] != 0 ; ++ i ) { long o2i = orb2 [ i ] ; for ( j = 1 ; j <= len && orb1 [ j ] != o2i ; ++ j ) ; if ( j <= len ) { orb1 [ j ] = orb1 [ len ] ; orb1 [ len -- ] = 0 ; } } return len ; }
delete the elements in orb2 from orb1, an entry 0 marks the end of the
 list, returns the length of orb1
delete the elements in orb2 from orb1 an entry 0 marks the end of the list returns the length of orb1
/* orb1[j] = orb2[i], hence delete orb1[j] from orb1 */