[BACK]Return to level1.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / pari-2.2 / src / kernel / none

Diff for /OpenXM_contrib/pari-2.2/src/kernel/none/Attic/level1.h between version 1.1 and 1.2

version 1.1, 2001/10/02 11:17:08 version 1.2, 2002/09/11 07:27:00
Line 33  long   addssmod(long a, long b, long p);
Line 33  long   addssmod(long a, long b, long p);
 void   addssz(long x, long y, GEN z);  void   addssz(long x, long y, GEN z);
 void   affii(GEN x, GEN y);  void   affii(GEN x, GEN y);
 void   affsi(long s, GEN x);  void   affsi(long s, GEN x);
   void   affui(long s, GEN x);
 void   affsr(long s, GEN x);  void   affsr(long s, GEN x);
 GEN    cgetg(long x, long y);  GEN    cgetg(long x, long y);
 GEN    cgeti(long x);  GEN    cgeti(long x);
Line 62  long   expi(GEN x);
Line 63  long   expi(GEN x);
 double gtodouble(GEN x);  double gtodouble(GEN x);
 GEN    icopy(GEN x);  GEN    icopy(GEN x);
 GEN    icopy_av(GEN x, GEN y);  GEN    icopy_av(GEN x, GEN y);
   GEN    itor(GEN x, long prec);
 long   itos(GEN x);  long   itos(GEN x);
   ulong  itou(GEN x);
 GEN    modis(GEN x, long y);  GEN    modis(GEN x, long y);
 GEN    mpabs(GEN x);  GEN    mpabs(GEN x);
 GEN    mpadd(GEN x, GEN y);  GEN    mpadd(GEN x, GEN y);
Line 81  void   mulssz(long x, long y, GEN z);
Line 84  void   mulssz(long x, long y, GEN z);
 GEN    new_chunk(long x);  GEN    new_chunk(long x);
 GEN    realun(long prec);  GEN    realun(long prec);
 GEN    realzero(long prec);  GEN    realzero(long prec);
   GEN    realzero_bit(long bitprec);
 void   resiiz(GEN x, GEN y, GEN z);  void   resiiz(GEN x, GEN y, GEN z);
 GEN    resis(GEN x, long y);  GEN    resis(GEN x, long y);
 GEN    ressi(long x, GEN y);  GEN    ressi(long x, GEN y);
 GEN    shiftr(GEN x, long n);  GEN    shiftr(GEN x, long n);
 long   smodis(GEN x, long y);  long   smodis(GEN x, long y);
   GEN    stor(long x, long prec);
 GEN    stoi(long x);  GEN    stoi(long x);
 GEN    subii(GEN x, GEN y);  GEN    subii(GEN x, GEN y);
 GEN    subir(GEN x, GEN y);  GEN    subir(GEN x, GEN y);
Line 102  INLINE long
Line 107  INLINE long
 evallg(long x)  evallg(long x)
 {  {
   if (x & ~LGBITS) err(errlg);    if (x & ~LGBITS) err(errlg);
   return m_evallg(x);    return _evallg(x);
 }  }
   
 INLINE long  INLINE long
 evallgef(long x)  evallgef(long x)
 {  {
   if (x & ~LGEFBITS) err(errlgef);    if (x & ~LGEFBITS) err(errlgef);
   return m_evallgef(x);    return _evallgef(x);
 }  }
   
 INLINE long  INLINE long
 evalvalp(long x)  evalvalp(long x)
 {  {
   const long v = m_evalvalp(x);    const long v = _evalvalp(x);
   if (v & ~VALPBITS) err(errvalp);    if (v & ~VALPBITS) err(errvalp);
   return v;    return v;
 }  }
Line 123  evalvalp(long x)
Line 128  evalvalp(long x)
 INLINE long  INLINE long
 evalexpo(long x)  evalexpo(long x)
 {  {
   const long v = m_evalexpo(x);    const long v = _evalexpo(x);
   if (v & ~EXPOBITS) err(errexpo);    if (v & ~EXPOBITS) err(errexpo);
   return v;    return v;
 }  }
Line 139  new_chunk(long x)
Line 144  new_chunk(long x)
 #ifdef _WIN32  #ifdef _WIN32
   if (win32ctrlc) dowin32ctrlc();    if (win32ctrlc) dowin32ctrlc();
 #endif  #endif
   avma = (long)z; return z;    avma = (gpmem_t)z; return z;
 }  }
   
 /* THE FOLLOWING ONES ARE IN mp.s */  /* THE FOLLOWING ONES ARE IN mp.s */
Line 219  mpabs(GEN x)
Line 224  mpabs(GEN x)
 INLINE long  INLINE long
 smodis(GEN x, long y)  smodis(GEN x, long y)
 {  {
   const long av=avma; divis(x,y); avma=av;    const gpmem_t av=avma; divis(x,y); avma=av;
   if (!hiremainder) return 0;    if (!hiremainder) return 0;
   return (signe(x)>0) ? hiremainder: labs(y)+hiremainder;    return (signe(x)>0) ? hiremainder: labs(y)+hiremainder;
 }  }
Line 260  stoi(long x)
Line 265  stoi(long x)
 INLINE long  INLINE long
 itos(GEN x)  itos(GEN x)
 {  {
   const long s=signe(x);    const long s = signe(x);
   long p1;    long u;
   
   if (!s) return 0;    if (!s) return 0;
   if (lgefint(x)>3) err(affer2);    u = (long)x[2]; if (lgefint(x) > 3 || u < 0) err(affer2);
   p1=x[2]; if (p1 < 0) err(affer2);    return (s>0) ? u : -u;
   return (s>0) ? p1 : -(long)p1;  
 }  }
   
 INLINE void  INLINE void
Line 282  affii(GEN x, GEN y)
Line 286  affii(GEN x, GEN y)
 INLINE void  INLINE void
 affsi(long s, GEN x)  affsi(long s, GEN x)
 {  {
   if (!s) { x[1]=2; return; }    if (!s) x[1] = evalsigne(0) | evallgefint(2);
   if (lg(x)<3) err(affer1);    else
   if (s>0) { x[1] = evalsigne(1) | evallgefint(3); x[2] = s; }    {
   else { x[1] = evalsigne(-1) | evallgefint(3); x[2] = -s; }      if (lg(x) < 3) err(affer1);
       if (s > 0) { x[1] = evalsigne( 1) | evallgefint(3); x[2] =  s; }
       else       { x[1] = evalsigne(-1) | evallgefint(3); x[2] = -s; }
     }
 }  }
   
 INLINE void  INLINE void
Line 295  affsr(long s, GEN x)
Line 302  affsr(long s, GEN x)
   
   if (!s)    if (!s)
   {    {
     l = -bit_accuracy(lg(x));      x[1] = evalexpo(-bit_accuracy(lg(x)));
     x[1]=evalexpo(l); x[2]=0; return;      return;
   }    }
   if (s<0) { x[1] = evalsigne(-1); s = -s; }    if (s<0) { x[1] = evalsigne(-1); s = -s; }
   else x[1] = evalsigne(1);    else x[1] = evalsigne(1);
Line 326  shiftr(GEN x, long n)
Line 333  shiftr(GEN x, long n)
 INLINE int  INLINE int
 cmpir(GEN x, GEN y)  cmpir(GEN x, GEN y)
 {  {
   long av;    gpmem_t av;
   GEN z;    GEN z;
   
   if (!signe(x)) return -signe(y);    if (!signe(x)) return -signe(y);
     if (!signe(y)) return  signe(x);
   av=avma; z=cgetr(lg(y)); affir(x,z); avma=av;    av=avma; z=cgetr(lg(y)); affir(x,z); avma=av;
   return cmprr(z,y); /* cmprr does no memory adjustment */    return cmprr(z,y); /* cmprr does no memory adjustment */
 }  }
Line 337  cmpir(GEN x, GEN y)
Line 345  cmpir(GEN x, GEN y)
 INLINE int  INLINE int
 cmpsr(long x, GEN y)  cmpsr(long x, GEN y)
 {  {
   long av;    gpmem_t av;
   GEN z;    GEN z;
   
   if (!x) return -signe(y);    if (!x) return -signe(y);
Line 351  addssz(long x, long y, GEN z)
Line 359  addssz(long x, long y, GEN z)
   if (typ(z)==t_INT) gops2ssz(addss,x,y,z);    if (typ(z)==t_INT) gops2ssz(addss,x,y,z);
   else    else
   {    {
     const long av=avma;      const gpmem_t av=avma;
     const GEN p1=cgetr(lg(z));      const GEN p1=cgetr(lg(z));
   
     affsr(x,p1); affrr(addrs(p1,y),z); avma=av;      affsr(x,p1); affrr(addrs(p1,y),z); avma=av;
Line 426  mulssz(long x, long y, GEN z)
Line 434  mulssz(long x, long y, GEN z)
   if (typ(z)==t_INT) gops2ssz(mulss,x,y,z);    if (typ(z)==t_INT) gops2ssz(mulss,x,y,z);
   else    else
   {    {
     const long av=avma;      const gpmem_t av=avma;
     const GEN p1=cgetr(lg(z));      const GEN p1=cgetr(lg(z));
   
     affsr(x,p1); mpaff(mulsr(y,p1),z); avma=av;      affsr(x,p1); mpaff(mulsr(y,p1),z); avma=av;
Line 436  mulssz(long x, long y, GEN z)
Line 444  mulssz(long x, long y, GEN z)
 INLINE void  INLINE void
 mulsii(long x, GEN y, GEN z)  mulsii(long x, GEN y, GEN z)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   affii(mulsi(x,y),z); avma=av;    affii(mulsi(x,y),z); avma=av;
 }  }
   
 INLINE void  INLINE void
 addsii(long x, GEN y, GEN z)  addsii(long x, GEN y, GEN z)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   affii(addsi(x,y),z); avma=av;    affii(addsi(x,y),z); avma=av;
 }  }
   
 INLINE long  INLINE long
 divisii(GEN x, long y, GEN z)  divisii(GEN x, long y, GEN z)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   affii(divis(x,y),z); avma=av; return hiremainder;    affii(divis(x,y),z); avma=av; return hiremainder;
 }  }
   
Line 501  dvmdis(GEN x, long y, GEN *z)
Line 509  dvmdis(GEN x, long y, GEN *z)
 INLINE void  INLINE void
 dvmdssz(long x, long y, GEN z, GEN t)  dvmdssz(long x, long y, GEN z, GEN t)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   const GEN p1=divss(x,y);    const GEN p1=divss(x,y);
   
   affsi(hiremainder,t); mpaff(p1,z); avma=av;    affsi(hiremainder,t); mpaff(p1,z); avma=av;
Line 510  dvmdssz(long x, long y, GEN z, GEN t)
Line 518  dvmdssz(long x, long y, GEN z, GEN t)
 INLINE void  INLINE void
 dvmdsiz(long x, GEN y, GEN z, GEN t)  dvmdsiz(long x, GEN y, GEN z, GEN t)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   const GEN p1=divsi(x,y);    const GEN p1=divsi(x,y);
   
   affsi(hiremainder,t); mpaff(p1,z); avma=av;    affsi(hiremainder,t); mpaff(p1,z); avma=av;
Line 519  dvmdsiz(long x, GEN y, GEN z, GEN t)
Line 527  dvmdsiz(long x, GEN y, GEN z, GEN t)
 INLINE void  INLINE void
 dvmdisz(GEN x, long y, GEN z, GEN t)  dvmdisz(GEN x, long y, GEN z, GEN t)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   const GEN p1=divis(x,y);    const GEN p1=divis(x,y);
   
   affsi(hiremainder,t); mpaff(p1,z); avma=av;    affsi(hiremainder,t); mpaff(p1,z); avma=av;
Line 528  dvmdisz(GEN x, long y, GEN z, GEN t)
Line 536  dvmdisz(GEN x, long y, GEN z, GEN t)
 INLINE void  INLINE void
 dvmdiiz(GEN x, GEN y, GEN z, GEN t)  dvmdiiz(GEN x, GEN y, GEN z, GEN t)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   GEN p;    GEN p;
   
   mpaff(dvmdii(x,y,&p),z); mpaff(p,t); avma=av;    mpaff(dvmdii(x,y,&p),z); mpaff(p,t); avma=av;
Line 543  modis(GEN x, long y)
Line 551  modis(GEN x, long y)
 INLINE GEN  INLINE GEN
 ressi(long x, GEN y)  ressi(long x, GEN y)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   divsi(x,y); avma=av; return stoi(hiremainder);    divsi(x,y); avma=av; return stoi(hiremainder);
 }  }
   
 INLINE GEN  INLINE GEN
 resis(GEN x, long y)  resis(GEN x, long y)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   divis(x,y); avma=av; return stoi(hiremainder);    divis(x,y); avma=av; return stoi(hiremainder);
 }  }
   
Line 560  divisz(GEN x, long y, GEN z)
Line 568  divisz(GEN x, long y, GEN z)
   if (typ(z)==t_INT) gops2gsz(divis,x,y,z);    if (typ(z)==t_INT) gops2gsz(divis,x,y,z);
   else    else
   {    {
     const long av=avma;      const gpmem_t av=avma;
     const GEN p1=cgetr(lg(z));      const GEN p1=cgetr(lg(z));
   
     affir(x,p1); affrr(divrs(p1,y),z); avma=av;      affir(x,p1); affrr(divrs(p1,y),z); avma=av;
Line 570  divisz(GEN x, long y, GEN z)
Line 578  divisz(GEN x, long y, GEN z)
 INLINE void  INLINE void
 divsiz(long x, GEN y, GEN z)  divsiz(long x, GEN y, GEN z)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   
   if (typ(z)==t_INT) gaffect(divsi(x,y),z);    if (typ(z)==t_INT) gaffect(divsi(x,y),z);
   else    else
Line 587  divsiz(long x, GEN y, GEN z)
Line 595  divsiz(long x, GEN y, GEN z)
 INLINE void  INLINE void
 divssz(long x, long y, GEN z)  divssz(long x, long y, GEN z)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   
   if (typ(z)==t_INT) gaffect(divss(x,y),z);    if (typ(z)==t_INT) gaffect(divss(x,y),z);
   else    else
Line 602  divssz(long x, long y, GEN z)
Line 610  divssz(long x, long y, GEN z)
 INLINE void  INLINE void
 divrrz(GEN x, GEN y, GEN z)  divrrz(GEN x, GEN y, GEN z)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   mpaff(divrr(x,y),z); avma=av;    mpaff(divrr(x,y),z); avma=av;
 }  }
   
 INLINE void  INLINE void
 resiiz(GEN x, GEN y, GEN z)  resiiz(GEN x, GEN y, GEN z)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   affii(resii(x,y),z); avma=av;    affii(resii(x,y),z); avma=av;
 }  }
   
 INLINE int  INLINE int
 divise(GEN x, GEN y)  divise(GEN x, GEN y)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   const GEN p1=resii(x,y);    const GEN p1=resii(x,y);
   avma=av; return p1 == gzero;    avma=av; return p1 == gzero;
 }  }
Line 664  mpdiv(GEN x, GEN y)
Line 672  mpdiv(GEN x, GEN y)
 INLINE int  INLINE int
 mpdivis(GEN x, GEN y, GEN z)  mpdivis(GEN x, GEN y, GEN z)
 {  {
   const long av=avma;    const gpmem_t av=avma;
   GEN p2;    GEN p2;
   const GEN p1=dvmdii(x,y,&p2);    const GEN p1=dvmdii(x,y,&p2);
   
Line 675  mpdivis(GEN x, GEN y, GEN z)
Line 683  mpdivis(GEN x, GEN y, GEN z)
 /* THE FOLLOWING ONES ARE NOT IN mp.s */  /* THE FOLLOWING ONES ARE NOT IN mp.s */
 #  endif /* !defined(__M68K__) */  #  endif /* !defined(__M68K__) */
   
   INLINE ulong
   itou(GEN x)
   {
     const long s = signe(x);
   
     if (!s) return 0;
     if (lgefint(x) > 3) err(affer2);
     return x[2];
   }
   
   INLINE void
   affui(ulong u, GEN x)
   {
     if (!u) x[1] = evalsigne(0) | evallgefint(2);
     else
     {
       if (lg(x) < 3) err(affer1);
       x[1] = evalsigne(1) | evallgefint(3); x[2] = u;
     }
   }
   
 INLINE int  INLINE int
 mpdivisis(GEN x, long y, GEN z)  mpdivisis(GEN x, long y, GEN z)
 {  {
   const ulong av = avma;    const gpmem_t av = avma;
   GEN p1 = divis(x,y);    GEN p1 = divis(x,y);
   if (hiremainder) { avma = av; return 0; }    if (hiremainder) { avma = av; return 0; }
   affii(p1,z); avma = av; return 1;    affii(p1,z); avma = av; return 1;
Line 687  mpdivisis(GEN x, long y, GEN z)
Line 716  mpdivisis(GEN x, long y, GEN z)
 INLINE double  INLINE double
 gtodouble(GEN x)  gtodouble(GEN x)
 {  {
   static long reel4[4]={ evaltyp(t_REAL) | m_evallg(4),0,0,0 };    static long reel4[4]={ evaltyp(t_REAL) | _evallg(4),0,0,0 };
   
   if (typ(x)==t_REAL) return rtodbl(x);    if (typ(x)==t_REAL) return rtodbl(x);
   gaffect(x,(GEN)reel4); return rtodbl((GEN)reel4);    gaffect(x,(GEN)reel4); return rtodbl((GEN)reel4);
 }  }
   
 INLINE GEN  INLINE GEN
 realzero(long prec)  realzero_bit(long bitprec) { GEN x=cgetr(2); x[1]=evalexpo(bitprec); return x; }
 {  
   GEN x=cgetr(3);  
   x[1]=evalexpo(-bit_accuracy(prec));  
   x[2]=0; return x;  
 }  
   
 INLINE GEN  INLINE GEN
 realun(long prec)  realzero(long prec) { return realzero_bit(-bit_accuracy(prec)); }
 {  
   GEN x=cgetr(prec); affsr(1,x);  INLINE GEN
   return x;  realun(long prec) { GEN x=cgetr(prec); affsr(1,x); return x; }
 }  
   INLINE GEN
   stor(long s, long prec) { GEN z = cgetr(prec); affsr(s,z); return z; }
   
   INLINE GEN
   itor(GEN x, long prec) { GEN z = cgetr(prec); affir(x,z); return z; }
   
 INLINE long  INLINE long
 addssmod(long a, long b, long p)  addssmod(long a, long b, long p)

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>