bridge/class-master/depend/pari/src/basemath/bibli2.c
/* adapted from gen_search; don't export: keys of T[i] should be precomputed */
adapted from gen_search; don't export: keys of T[i] should be precomputed
adapted from gen_search ; don ' t export : keys of T [ i ] should be precomputed
static long
key_search(GEN T, GEN x, GEN code)
{
  long u = lg(T)-1, i, l, s;
  if (!u) return 0;
  l = 1; x = closure_callgen1(code, x);
  do
  {
    i = (l+u)>>1; s = lexcmp(x, closure_callgen1(code, gel(T,i)));
    if (!s) return i;
    if (s<0) u=i-1; else l=i+1;
  } while (u>=l);
  return 0;
}
static long key_search ( GEN T , GEN x , GEN code ) { long u = lg ( T ) - 1 , i , l , s ; if ( ! u ) return 0 ; l = 1 ; x = closure_callgen1 ( code , x ) ; do { i = ( l + u ) >> 1 ; s = lexcmp ( x , closure_callgen1 ( code , gel ( T , i ) ) ) ; if ( ! s ) return i ; if ( s < 0 ) u = i - 1 ; else l = i + 1 ; } while ( u >= l ) ; return 0 ; }
adapted from gen_search; don't export: keys of T[i] should be precomputed
adapted from gen_search ; don ' t export : keys of T [ i ] should be precomputed