bridge/class-master/depend/pari/src/basemath/gen2.c
/*******************************************************************/
/*                                                                 */
/*                              LISTS                              */
/*                                                                 */
/*******************************************************************/
/* make sure L can hold l elements, at least doubling the previous max number
 * of components. */
LISTS

make sure L can hold l elements, at least doubling the previous max number
of components.
LISTS make sure L can hold l elements at least doubling the previous max number of components .
static void
ensure_nb(GEN L, long l)
{
  long nmax = list_nmax(L), i, lw;
  GEN v, w;
  if (l <= nmax) return;
  if (nmax)
  {
    nmax <<= 1;
    if (l > nmax) nmax = l;
    w = list_data(L); lw = lg(w);
    v = newblock(nmax+1);
    v[0] = w[0];
    for (i=1; i < lw; i++) gel(v,i) = gel(w, i);
    killblock(w);
  }
  else 
  {
    nmax = 32;
    if (list_data(L))
      pari_err(e_MISC, "store list in variable before appending elements");
    v = newblock(nmax+1);
    v[0] = evaltyp(t_VEC) | _evallg(1);
  }
  list_data(L) = v;
  L[1] = evaltyp(list_typ(L))|evallg(nmax);
}
static void ensure_nb ( GEN L , long l ) { long nmax = list_nmax ( L ) , i , lw ; GEN v , w ; if ( l <= nmax ) return ; if ( nmax ) { nmax <<= 1 ; if ( l > nmax ) nmax = l ; w = list_data ( L ) ; lw = lg ( w ) ; v = newblock ( nmax + 1 ) ; v [ 0 ] = w [ 0 ] ; for ( i = 1 ; i < lw ; i ++ ) gel ( v , i ) = gel ( w , i ) ; killblock ( w ) ; } else { nmax = 32 ; if ( list_data ( L ) ) pari_err ( e_MISC , " " ) ; v = newblock ( nmax + 1 ) ; v [ 0 ] = evaltyp ( t_VEC ) | _evallg ( 1 ) ; } list_data ( L ) = v ; L [ 1 ] = evaltyp ( list_typ ( L ) ) | evallg ( nmax ) ; }
LISTS
LISTS
/* unallocated */