473{
476 {
479 {
481 number numberToInsert = (number)
v->Data();
482 int lowerBound = 0;
483 int upperBound =
lSize(listOfNumbers);
484 if (upperBound<0)
485 {
487 res->data = (
void*) (
long) (lowerBound+1);
489 }
490
491 number lowerNumber = (number) listOfNumbers->
m[lowerBound].
Data();
493 {
495 res->data = (
void*) (
long) (-1);
497 }
499 {
501 res->data = (
void*) (
long) (lowerBound+1);
503 }
504
505 number upperNumber = (number) listOfNumbers->
m[upperBound].
Data();
507 {
509 res->data = (
void*) (
long) (-1);
511 }
513 {
515 res->data = (
void*) (
long) (upperBound+2);
517 }
518
519 while (lowerBound+1<upperBound)
520 {
521 int middle = lowerBound + (upperBound-lowerBound) / 2;
522 number lowerNumber = (number) listOfNumbers->
m[lowerBound].
Data();
523 number upperNumber = (number) listOfNumbers->
m[upperBound].
Data();
524 number middleNumber = (number) listOfNumbers->
m[middle].
Data();
528 {
530 res->data = (
void*) (
long) -1;
532 }
534 lowerBound = middle;
536 upperBound = middle;
537 }
538
540 res->data = (
void*) (
long) (upperBound+1);
542 }
543 }
544 WerrorS(
"findPlaceToInsert: unexpected parameter");
546}
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff 'a' is larger than 'b'; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.