Code coverage tests

This page documents the degree to which the PARI/GP source code is tested by our public test suite, distributed with the source distribution in directory src/test/. This is measured by the gcov utility; we then process gcov output using the lcov frond-end.

We test a few variants depending on Configure flags on the pari.math.u-bordeaux.fr machine (x86_64 architecture), and agregate them in the final report:

The target is to exceed 90% coverage for all mathematical modules (given that branches depending on DEBUGLEVEL or DEBUGMEM are not covered). This script is run to produce the results below.

LCOV - code coverage report
Current view: top level - kernel/none - level1.h (source / functions) Hit Total Coverage
Test: PARI/GP v2.12.1 lcov report (development 25579-8c4672f557) Lines: 587 750 78.3 %
Date: 2020-07-09 06:03:45 Functions: 211 278 75.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #line 2 "../src/kernel/none/level1.h"
       2             : /* Copyright (C) 2000  The PARI group.
       3             : 
       4             : This file is part of the PARI/GP package.
       5             : 
       6             : PARI/GP is free software; you can redistribute it and/or modify it under the
       7             : terms of the GNU General Public License as published by the Free Software
       8             : Foundation. It is distributed in the hope that it will be useful, but WITHOUT
       9             : ANY WARRANTY WHATSOEVER.
      10             : 
      11             : Check the License for details. You should have received a copy of it, along
      12             : with the package; see the file 'COPYING'. If not, write to the Free Software
      13             : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
      14             : 
      15             : /* This file defines "level 1" kernel functions.
      16             :  * These functions can be inline; they are also defined externally in
      17             :  * mpinl.c, which includes this file and never needs to be changed */
      18             : 
      19             : INLINE long
      20 52305266266 : evallg(long x)
      21             : {
      22 52305266266 :   if (x & ~LGBITS) pari_err_OVERFLOW("lg()");
      23 52303801732 :   return _evallg(x);
      24             : }
      25             : INLINE long
      26    29154459 : evalvalp(long x)
      27             : {
      28    29154459 :   long v = _evalvalp(x);
      29    29154459 :   if (v & ~VALPBITS) pari_err_OVERFLOW("valp()");
      30    29154455 :   return v;
      31             : }
      32             : INLINE long
      33  7904722243 : evalexpo(long x)
      34             : {
      35  7904722243 :   long v = _evalexpo(x);
      36  7904722243 :   if (v & ~EXPOBITS) pari_err_OVERFLOW("expo()");
      37  7904986057 :   return v;
      38             : }
      39             : INLINE long
      40     8693942 : evalprecp(long x)
      41             : {
      42     8693942 :   long v = _evalprecp(x);
      43     8693942 :   if (x & ~((1UL<<(BITS_IN_LONG-VALPnumBITS))-1)) pari_err_OVERFLOW("precp()");
      44     8693944 :   return v;
      45             : }
      46             : 
      47             : INLINE int
      48   155545367 : varncmp(long x, long y)
      49             : {
      50   155545367 :   if (varpriority[x] < varpriority[y]) return  1;
      51   118231590 :   if (varpriority[x] > varpriority[y]) return -1;
      52    64760020 :   return 0;
      53             : }
      54             : INLINE long
      55           0 : varnmin(long x, long y)
      56           0 : { return (varpriority[x] <= varpriority[y])? x: y; }
      57             : INLINE long
      58         196 : varnmax(long x, long y)
      59         196 : { return (varpriority[x] >= varpriority[y])? x: y; }
      60             : 
      61             : /* Inhibit some area gerepile-wise: declare it to be a non recursive
      62             :  * type, of length l. Thus gerepile won't inspect the zone, just copy it.
      63             :  * For the following situation:
      64             :  *   z = cgetg(t,a); av = avma; garbage(); ltop = avma;
      65             :  *   for (i=1; i<HUGE; i++) gel(z,i) = blah();
      66             :  *   stackdummy(av,ltop);
      67             :  * loses (av-ltop) words but save a costly gerepile. */
      68             : INLINE void
      69  1697746803 : stackdummy(pari_sp av, pari_sp ltop) {
      70  1697746803 :   long l = ((GEN)av) - ((GEN)ltop);
      71  1697746803 :   if (l > 0) {
      72   568226805 :     GEN z = (GEN)ltop;
      73   568226805 :     z[0] = evaltyp(t_VECSMALL) | evallg(l);
      74             : #ifdef DEBUG
      75             :     { long i; for (i = 1; i < l; i++) z[i] = 0; }
      76             : #endif
      77             :   }
      78  1697670544 : }
      79             : INLINE void
      80    62411769 : fixlg(GEN x, long ly) {
      81    62411769 :   long lx = lg(x), l = lx - ly;
      82    62411769 :   if (l > 0)
      83             :   { /* stackdummy(x+lx, x+ly) */
      84    43292809 :     GEN z = x + ly;
      85    43292809 :     z[0] = evaltyp(t_VECSMALL) | evallg(l);
      86    43292744 :     setlg(x, ly);
      87             : #ifdef DEBUG
      88             :     { long i; for (i = 1; i < l; i++) z[i] = 0; }
      89             : #endif
      90             :   }
      91    62411649 : }
      92             : /* update lg(z) before affrr(y, z)  [ to cater for precision loss ]*/
      93             : INLINE void
      94    19126669 : affrr_fixlg(GEN y, GEN z) { fixlg(z, lg(y)); affrr(y, z); }
      95             : 
      96             : /*******************************************************************/
      97             : /*                                                                 */
      98             : /*                       ALLOCATE ON STACK                         */
      99             : /*                                                                 */
     100             : /*******************************************************************/
     101             : INLINE void
     102 69396619495 : set_avma(ulong av) { avma = av; }
     103             : 
     104             : INLINE double
     105     3113350 : gc_double(pari_sp av, double d) { set_avma(av); return d; }
     106             : INLINE long
     107   119978231 : gc_long(pari_sp av, long s) { set_avma(av); return s; }
     108             : INLINE ulong
     109    14054604 : gc_ulong(pari_sp av, ulong s) { set_avma(av); return s; }
     110             : INLINE int
     111    21151072 : gc_bool(pari_sp av, int s) { set_avma(av); return s; }
     112             : INLINE int
     113     1088949 : gc_int(pari_sp av, int s) { set_avma(av); return s; }
     114             : INLINE GEN
     115     1644252 : gc_NULL(pari_sp av) { set_avma(av); return NULL; }
     116             : INLINE GEN
     117  7084972796 : gc_const(pari_sp av, GEN x) { set_avma(av); return x; }
     118             : 
     119             : INLINE GEN
     120 50341281643 : new_chunk(size_t x) /* x is a number of longs */
     121             : {
     122 50341281643 :   GEN z = ((GEN) avma) - x;
     123             :   CHECK_CTRLC
     124 50341281643 :   if (x > (avma-pari_mainstack->bot) / sizeof(long))
     125           7 :     new_chunk_resize(x);
     126 50341281636 :   set_avma((pari_sp)z);
     127             : #ifdef MEMSTEP
     128             :   if (DEBUGMEM>1 && pari_mainstack->memused != DISABLE_MEMUSED) {
     129             :     long d = (long)pari_mainstack->memused - (long)z;
     130             :     if (labs(d) > 4*MEMSTEP)
     131             :     {
     132             :       pari_mainstack->memused = (pari_sp)z;
     133             :       err_printf("...%4.0lf Mbytes used\n",
     134             :                 (pari_mainstack->top-pari_mainstack->memused)/1048576.);
     135             :     }
     136             :   }
     137             : #endif
     138 50327090296 :   return z;
     139             : }
     140             : 
     141             : INLINE char *
     142     5307236 : stack_malloc(size_t N)
     143             : {
     144     5307236 :   long n = nchar2nlong(N);
     145     5307236 :   return (char*)new_chunk(n);
     146             : }
     147             : 
     148             : INLINE char *
     149     1543045 : stack_malloc_align(size_t N, long k)
     150             : {
     151     1543045 :   ulong d = ((ulong)avma) % k, e = ((ulong)N) % k;
     152     1543045 :   if (d) (void)new_chunk(d/sizeof(long));
     153     1543045 :   if (e) N += k-e;
     154     1543045 :   return (char*) new_chunk(nchar2nlong(N));
     155             : }
     156             : 
     157             : INLINE char *
     158       58123 : stack_calloc(size_t N)
     159             : {
     160       58123 :   char *p = stack_malloc(N);
     161       58123 :   memset(p, 0, N); return p;
     162             : }
     163             : 
     164             : INLINE char *
     165         349 : stack_calloc_align(size_t N, long k)
     166             : {
     167         349 :   ulong d = ((ulong)avma) % k, e = ((ulong)N) % k;
     168         349 :   if (d) (void)new_chunk(d/sizeof(long));
     169         349 :   if (e) N += k-e;
     170         349 :   return stack_calloc(N);
     171             : }
     172             : 
     173             : /* cgetg(lg(x), typ(x)), set *lx. Implicit unsetisclone() */
     174             : INLINE GEN
     175   573562250 : cgetg_copy(GEN x, long *plx) {
     176             :   GEN y;
     177   573562250 :   *plx = lg(x); y = new_chunk((size_t)*plx);
     178   573557228 :   y[0] = x[0] & (TYPBITS|LGBITS); return y;
     179             : }
     180             : INLINE GEN
     181      195452 : cgetg_block(long x, long y)
     182             : {
     183      195452 :   GEN z = newblock((size_t)x);
     184      195243 :   z[0] = CLONEBIT | evaltyp(y) | evallg(x);
     185      195243 :   return z;
     186             : }
     187             : INLINE GEN
     188  6745927129 : cgetg(long x, long y)
     189             : {
     190  6745927129 :   GEN z = new_chunk((size_t)x);
     191  6743346945 :   z[0] = evaltyp(y) | evallg(x);
     192  6741461448 :   return z;
     193             : }
     194             : INLINE GEN
     195 16190786552 : cgeti(long x)
     196             : {
     197 16190786552 :   GEN z = new_chunk((size_t)x);
     198 16169683413 :   z[0] = evaltyp(t_INT) | evallg(x);
     199 16161095045 :   return z;
     200             : }
     201             : INLINE GEN
     202  9572069708 : cgetipos(long x)
     203             : {
     204  9572069708 :   GEN z = cgeti(x);
     205  9569228667 :   z[1] = evalsigne(1) | evallgefint(x);
     206  9569228667 :   return z;
     207             : }
     208             : INLINE GEN
     209   229857912 : cgetineg(long x)
     210             : {
     211   229857912 :   GEN z = cgeti(x);
     212   229857927 :   z[1] = evalsigne(-1) | evallgefint(x);
     213   229857927 :   return z;
     214             : }
     215             : INLINE GEN
     216       24911 : cgetr_block(long x)
     217             : {
     218       24911 :   GEN z = newblock((size_t)x);
     219       24921 :   z[0] = CLONEBIT | evaltyp(t_REAL) | evallg(x);
     220       24920 :   return z;
     221             : }
     222             : INLINE GEN
     223  8102050170 : cgetr(long x)
     224             : {
     225  8102050170 :   GEN z = new_chunk((size_t)x);
     226  8098988589 :   z[0] = evaltyp(t_REAL) | evallg(x);
     227  8097790265 :   return z;
     228             : }
     229             : 
     230             : /*******************************************************************/
     231             : /*                                                                 */
     232             : /*                     COPY, NEGATION, ABSOLUTE VALUE              */
     233             : /*                                                                 */
     234             : /*******************************************************************/
     235             : /* cannot do memcpy because sometimes x and y overlap */
     236             : INLINE GEN
     237  1922257166 : leafcopy(GEN x)
     238             : {
     239  1922257166 :   register long lx = lg(x);
     240  1922257166 :   GEN y = new_chunk(lx); /* can't use cgetg_copy, in case x,y overlap */
     241 12127539136 :   while (--lx > 0) y[lx] = x[lx];
     242  1922520875 :   y[0] = x[0] & (TYPBITS|LGBITS); return y;
     243             : }
     244             : INLINE GEN
     245  4940910209 : icopy(GEN x)
     246             : {
     247  4940910209 :   long i = lgefint(x), lx = i;
     248  4940910209 :   GEN y = new_chunk(lx); /* can't use cgeti, in case x,y overlap */
     249 19985884101 :   while (--i > 0) y[i] = x[i];
     250  4937818058 :   y[0] = evaltyp(t_INT) | evallg(lx);
     251  4942473382 :   return y;
     252             : }
     253             : INLINE GEN
     254    43927852 : icopyspec(GEN x, long nx)
     255             : {
     256    43927852 :   long i = nx+2, lx = i;
     257    43927852 :   GEN y = new_chunk(lx); /* can't use cgeti, in case x,y overlap */
     258   569733282 :   x -= 2; while (--i >= 2) y[i] = x[i];
     259    43927208 :   y[1] = evalsigne(1) | evallgefint(lx);
     260    43927208 :   y[0] = evaltyp(t_INT) | evallg(lx);
     261    43926881 :   return y;
     262             : }
     263   344723525 : INLINE GEN rcopy(GEN x) { return leafcopy(x); }
     264         294 : INLINE GEN mpcopy(GEN x) { return leafcopy(x); }
     265             : 
     266             : INLINE GEN
     267   506227282 : mpabs(GEN x) { GEN y = leafcopy(x); setabssign(y); return y; }
     268             : INLINE GEN
     269     9686468 : mpabs_shallow(GEN x) { return signe(x) < 0? mpabs(x): x; }
     270   418391873 : INLINE GEN absi(GEN x) { return mpabs(x); }
     271    32104658 : INLINE GEN absi_shallow(GEN x) { return signe(x) < 0? negi(x): x; }
     272    72984860 : INLINE GEN absr(GEN x) { return mpabs(x); }
     273             : 
     274             : INLINE GEN
     275   452424687 : mpneg(GEN x) { GEN y = leafcopy(x); togglesign(y); return y; }
     276   337268199 : INLINE GEN negi(GEN x) { return mpneg(x); }
     277     1488523 : INLINE GEN negr(GEN x) { return mpneg(x); }
     278             : 
     279             : /* negate in place */
     280             : INLINE void
     281   993624173 : togglesign(GEN x) { if (x[1] & SIGNBITS) { x[1] ^= HIGHBIT; } }
     282             : INLINE void
     283   556522833 : setabssign(GEN x) { x[1] &= ~HIGHBIT; }
     284             : /* negate in place, except universal constants */
     285             : INLINE void
     286    79546324 : togglesign_safe(GEN *px)
     287             : {
     288    79546324 :   switch(*px - gen_1) /* gen_1, gen_2, gen_m1, gen_m2 */
     289             :   {
     290      785368 :     case 0: *px = gen_m1; break;
     291           0 :     case 3: *px = gen_m2;  break;
     292      195826 :     case 6: *px = gen_1; break;
     293           0 :     case 9: *px = gen_2;  break;
     294    78565130 :     default: togglesign(*px);
     295             :   }
     296    79546324 : }
     297             : /* setsigne(y, signe(x)) */
     298             : INLINE void
     299           0 : affectsign(GEN x, GEN y)
     300             : {
     301           0 :   y[1] = (x[1] & SIGNBITS) | (y[1] & ~SIGNBITS);
     302           0 : }
     303             : /* copies sign in place, except for universal constants */
     304             : INLINE void
     305     5771682 : affectsign_safe(GEN x, GEN *py)
     306             : {
     307     5771682 :   if (((*py)[1] ^ x[1]) & HIGHBIT) togglesign_safe(py);
     308     5771682 : }
     309             : /*******************************************************************/
     310             : /*                                                                 */
     311             : /*                     GEN -> LONG, LONG -> GEN                    */
     312             : /*                                                                 */
     313             : /*******************************************************************/
     314             : /* assume x != 0, return -x as a t_INT */
     315             : INLINE GEN
     316   229672816 : utoineg(ulong x) { GEN y = cgetineg(3); y[2] = x; return y; }
     317             : /* assume x != 0, return utoi(x) */
     318             : INLINE GEN
     319  8564350535 : utoipos(ulong x) { GEN y = cgetipos(3); y[2] = x; return y; }
     320             : INLINE GEN
     321  7162746021 : utoi(ulong x) { return x? utoipos(x): gen_0; }
     322             : INLINE GEN
     323   369656605 : stoi(long x)
     324             : {
     325   369656605 :   if (!x) return gen_0;
     326   235002827 :   return x > 0? utoipos((ulong)x): utoineg((ulong)-x);
     327             : }
     328             : 
     329             : /* x 2^BIL + y */
     330             : INLINE GEN
     331  5027252153 : uutoi(ulong x, ulong y)
     332             : {
     333             :   GEN z;
     334  5027252153 :   if (!x) return utoi(y);
     335   397404772 :   z = cgetipos(4);
     336   397704947 :   *int_W_lg(z, 1, 4) = x;
     337   397704947 :   *int_W_lg(z, 0, 4) = y; return z;
     338             : }
     339             : /* - (x 2^BIL + y) */
     340             : INLINE GEN
     341      130815 : uutoineg(ulong x, ulong y)
     342             : {
     343             :   GEN z;
     344      130815 :   if (!x) return y? utoineg(y): gen_0;
     345       10243 :   z = cgetineg(4);
     346       10243 :   *int_W_lg(z, 1, 4) = x;
     347       10243 :   *int_W_lg(z, 0, 4) = y; return z;
     348             : }
     349             : 
     350             : INLINE long
     351   353471847 : itos(GEN x)
     352             : {
     353   353471847 :   long s = signe(x);
     354             :   long u;
     355             : 
     356   353471847 :   if (!s) return 0;
     357   337681089 :   u = x[2];
     358   337681089 :   if (lgefint(x) > 3 || u < 0)
     359          21 :     pari_err_OVERFLOW("t_INT-->long assignment");
     360   337681737 :   return (s>0) ? u : -u;
     361             : }
     362             : /* as itos, but return 0 if too large. Cf is_bigint */
     363             : INLINE long
     364    12993615 : itos_or_0(GEN x) {
     365             :   long n;
     366    12993615 :   if (lgefint(x) != 3 || (n = x[2]) & HIGHBIT) return 0;
     367    11321270 :   return signe(x) > 0? n: -n;
     368             : }
     369             : INLINE ulong
     370   115950712 : itou(GEN x)
     371             : {
     372   115950712 :   switch(lgefint(x)) {
     373     9006750 :     case 2: return 0;
     374   106943981 :     case 3: return x[2];
     375           0 :     default:
     376           0 :       pari_err_OVERFLOW("t_INT-->ulong assignment");
     377             :       return 0; /* LCOV_EXCL_LINE */
     378             :   }
     379             : }
     380             : 
     381             : /* as itou, but return 0 if too large. Cf is_bigint */
     382             : INLINE ulong
     383     4628093 : itou_or_0(GEN x) {
     384     4628093 :   if (lgefint(x) != 3) return 0;
     385     4617214 :   return (ulong)x[2];
     386             : }
     387             : 
     388             : INLINE ulong
     389     5146038 : umuluu_or_0(ulong x, ulong y)
     390             : {
     391             :   ulong z;
     392             :   LOCAL_HIREMAINDER;
     393     5146038 :   z = mulll(x, y);
     394     5146038 :   return hiremainder? 0: z;
     395             : }
     396             : /* return x*y if <= n, else 0. Beware overflow */
     397             : INLINE ulong
     398     2769016 : umuluu_le(ulong x, ulong y, ulong n)
     399             : {
     400             :   ulong z;
     401             :   LOCAL_HIREMAINDER;
     402     2769016 :   z = mulll(x, y);
     403     2769016 :   return (hiremainder || z > n)? 0: z;
     404             : }
     405             : 
     406             : INLINE GEN
     407   190591936 : real_0_bit(long bitprec) { GEN x=cgetr(2); x[1]=evalexpo(bitprec); return x; }
     408             : INLINE GEN
     409    73161609 : real_0(long prec) { return real_0_bit(-prec2nbits(prec)); }
     410             : INLINE GEN
     411      553541 : real_1_bit(long bit) { return real_1(nbits2prec(bit)); }
     412             : INLINE GEN
     413    41232175 : real_1(long prec) {
     414    41232175 :   GEN x = cgetr(prec);
     415             :   long i;
     416    41228652 :   x[1] = evalsigne(1) | _evalexpo(0);
     417   296647471 :   x[2] = (long)HIGHBIT; for (i=3; i<prec; i++) x[i] = 0;
     418    41228652 :   return x;
     419             : }
     420             : INLINE GEN
     421         154 : real_m1(long prec) {
     422         154 :   GEN x = cgetr(prec);
     423             :   long i;
     424         154 :   x[1] = evalsigne(-1) | _evalexpo(0);
     425        1032 :   x[2] = (long)HIGHBIT; for (i=3; i<prec; i++) x[i] = 0;
     426         154 :   return x;
     427             : }
     428             : 
     429             : /* 2.^n */
     430             : INLINE GEN
     431      173124 : real2n(long n, long prec) { GEN z = real_1(prec); setexpo(z, n); return z; }
     432             : INLINE GEN
     433           0 : real_m2n(long n, long prec) { GEN z = real_m1(prec); setexpo(z, n); return z; }
     434             : INLINE GEN
     435   169582357 : stor(long s, long prec) { GEN z = cgetr(prec); affsr(s,z); return z; }
     436             : INLINE GEN
     437     8735404 : utor(ulong s, long prec){ GEN z = cgetr(prec); affur(s,z); return z; }
     438             : INLINE GEN
     439   296955260 : itor(GEN x, long prec) { GEN z = cgetr(prec); affir(x,z); return z; }
     440             : INLINE GEN
     441    90526261 : rtor(GEN x, long prec) { GEN z = cgetr(prec); affrr(x,z); return z; }
     442             : 
     443    11786903 : INLINE ulong int_bit(GEN x, long n)
     444             : {
     445    11786903 :   long r, q = dvmdsBIL(n, &r);
     446    11790385 :   return q < lgefint(x)-2?((ulong)*int_W(x,q) >> r) & 1UL:0;
     447             : }
     448             : 
     449             : /*******************************************************************/
     450             : /*                                                                 */
     451             : /*                           COMPARISON                            */
     452             : /*                                                                 */
     453             : /*******************************************************************/
     454             : INLINE int
     455     1134094 : cmpss(long a, long b)
     456     1134094 : { return a>b? 1: (a<b? -1: 0); }
     457             : 
     458             : INLINE int
     459  1277325223 : cmpuu(ulong a, ulong b)
     460  1277325223 : { return a>b? 1: (a<b? -1: 0); }
     461             : 
     462             : INLINE int
     463      617175 : cmpir(GEN x, GEN y)
     464             : {
     465             :   pari_sp av;
     466             :   GEN z;
     467             : 
     468      617175 :   if (!signe(x)) return -signe(y);
     469      244318 :   if (!signe(y))
     470             :   {
     471        3564 :     if (expo(y) >= expi(x)) return 0;
     472        3536 :     return signe(x);
     473             :   }
     474      240754 :   av=avma; z = itor(x, realprec(y)); set_avma(av);
     475      240754 :   return cmprr(z,y); /* cmprr does no memory adjustment */
     476             : }
     477             : INLINE int
     478      365743 : cmpri(GEN x, GEN y) { return -cmpir(y,x); }
     479             : INLINE int
     480      100771 : cmpsr(long x, GEN y)
     481             : {
     482             :   pari_sp av;
     483             :   GEN z;
     484             : 
     485      100771 :   if (!x) return -signe(y);
     486      100771 :   av=avma; z = stor(x, LOWDEFAULTPREC); set_avma(av);
     487      100771 :   return cmprr(z,y);
     488             : }
     489             : INLINE int
     490       40131 : cmprs(GEN x, long y) { return -cmpsr(y,x); }
     491             : /* compare x and y */
     492             : INLINE int
     493     2186473 : cmpui(ulong x, GEN y)
     494             : {
     495             :   ulong p;
     496     2186473 :   if (!x) return -signe(y);
     497     2186473 :   if (signe(y) <= 0) return 1;
     498     2186459 :   if (lgefint(y) > 3) return -1;
     499     1571755 :   p = y[2]; if (p == x) return 0;
     500     1542697 :   return p < x ? 1 : -1;
     501             : }
     502             : INLINE int
     503     2186473 : cmpiu(GEN x, ulong y) { return -cmpui(y,x); }
     504             : /* compare x and |y| */
     505             : INLINE int
     506    26332104 : abscmpui(ulong x, GEN y)
     507             : {
     508    26332104 :   long l = lgefint(y);
     509             :   ulong p;
     510             : 
     511    26332104 :   if (!x) return (l > 2)? -1: 0;
     512    26332090 :   if (l == 2) return 1;
     513    26102034 :   if (l > 3) return -1;
     514    26091235 :   p = y[2]; if (p == x) return 0;
     515    25675166 :   return p < x ? 1 : -1;
     516             : }
     517             : INLINE int
     518    25844000 : abscmpiu(GEN x, ulong y) { return -abscmpui(y,x); }
     519             : INLINE int
     520     4049746 : cmpsi(long x, GEN y)
     521             : {
     522             :   ulong p;
     523             : 
     524     4049746 :   if (!x) return -signe(y);
     525             : 
     526     4048696 :   if (x > 0)
     527             :   {
     528     4047765 :     if (signe(y)<=0) return 1;
     529     4047450 :     if (lgefint(y)>3) return -1;
     530     4033658 :     p = y[2]; if (p == (ulong)x) return 0;
     531     3967452 :     return p < (ulong)x ? 1 : -1;
     532             :   }
     533             : 
     534         931 :   if (signe(y)>=0) return -1;
     535         147 :   if (lgefint(y)>3) return 1;
     536         147 :   p = y[2]; if (p == (ulong)-x) return 0;
     537          42 :   return p < (ulong)(-x) ? -1 : 1;
     538             : }
     539             : INLINE int
     540     4038965 : cmpis(GEN x, long y) { return -cmpsi(y,x); }
     541             : INLINE int
     542      577921 : mpcmp(GEN x, GEN y)
     543             : {
     544      577921 :   if (typ(x)==t_INT)
     545       10057 :     return (typ(y)==t_INT) ? cmpii(x,y) : cmpir(x,y);
     546      567864 :   return (typ(y)==t_INT) ? -cmpir(y,x) : cmprr(x,y);
     547             : }
     548             : 
     549             : /* x == y ? */
     550             : INLINE int
     551       32894 : equalui(ulong x, GEN y)
     552             : {
     553       32894 :   if (!x) return !signe(y);
     554       32894 :   if (signe(y) <= 0 || lgefint(y) != 3) return 0;
     555       32708 :   return ((ulong)y[2] == (ulong)x);
     556             : }
     557             : /* x == y ? */
     558             : INLINE int
     559      253278 : equalsi(long x, GEN y)
     560             : {
     561      253278 :   if (!x) return !signe(y);
     562      253278 :   if (x > 0)
     563             :   {
     564      253250 :     if (signe(y) <= 0 || lgefint(y) != 3) return 0;
     565      240435 :     return ((ulong)y[2] == (ulong)x);
     566             :   }
     567          28 :   if (signe(y) >= 0 || lgefint(y) != 3) return 0;
     568          28 :   return ((ulong)y[2] == (ulong)-x);
     569             : }
     570             : /* x == |y| ? */
     571             : INLINE int
     572    35360370 : absequalui(ulong x, GEN y)
     573             : {
     574    35360370 :   if (!x) return !signe(y);
     575    35360370 :   return (lgefint(y) == 3 && (ulong)y[2] == x);
     576             : }
     577             : INLINE int
     578    35253710 : absequaliu(GEN x, ulong y) { return absequalui(y,x); }
     579             : INLINE int
     580      253047 : equalis(GEN x, long y) { return equalsi(y,x); }
     581             : INLINE int
     582       32894 : equaliu(GEN x, ulong y) { return equalui(y,x); }
     583             : 
     584             : /* assume x != 0, is |x| == 2^n ? */
     585             : INLINE int
     586      335797 : absrnz_equal2n(GEN x) {
     587      335797 :   if ((ulong)x[2]==HIGHBIT)
     588             :   {
     589       22573 :     long i, lx = lg(x);
     590       92933 :     for (i = 3; i < lx; i++)
     591       79618 :       if (x[i]) return 0;
     592       13315 :     return 1;
     593             :   }
     594      313224 :   return 0;
     595             : }
     596             : /* assume x != 0, is |x| == 1 ? */
     597             : INLINE int
     598      665730 : absrnz_equal1(GEN x) { return !expo(x) && absrnz_equal2n(x); }
     599             : 
     600             : INLINE long
     601  5811420349 : maxss(long x, long y) { return x>y?x:y; }
     602             : INLINE long
     603   908863116 : minss(long x, long y) { return x<y?x:y; }
     604             : INLINE long
     605     2173777 : minuu(ulong x, ulong y) { return x<y?x:y; }
     606             : INLINE long
     607     6659072 : maxuu(ulong x, ulong y) { return x>y?x:y; }
     608             : INLINE double
     609     1154997 : maxdd(double x, double y) { return x>y?x:y; }
     610             : INLINE double
     611     1950596 : mindd(double x, double y) { return x<y?x:y; }
     612             : 
     613             : /*******************************************************************/
     614             : /*                                                                 */
     615             : /*                             ADD / SUB                           */
     616             : /*                                                                 */
     617             : /*******************************************************************/
     618             : INLINE GEN
     619       25046 : subuu(ulong x, ulong y)
     620             : {
     621             :   ulong z;
     622             :   LOCAL_OVERFLOW;
     623       25046 :   z = subll(x, y);
     624       25046 :   return overflow? utoineg(-z): utoi(z);
     625             : }
     626             : INLINE GEN
     627  2246182893 : adduu(ulong x, ulong y) { ulong t = x+y; return uutoi((t < x), t); }
     628             : 
     629             : INLINE GEN
     630       25046 : addss(long x, long y)
     631             : {
     632       25046 :   if (!x) return stoi(y);
     633       25046 :   if (!y) return stoi(x);
     634       25046 :   if (x > 0) return y > 0? adduu(x,y): subuu(x, -y);
     635             : 
     636       25046 :   if (y > 0) return subuu(y, -x);
     637             :   else { /* - adduu(-x, -y) */
     638           0 :     ulong t = (-x)+(-y); return uutoineg((t < (ulong)(-x)), t);
     639             :   }
     640             : }
     641       25046 : INLINE GEN subss(long x, long y) { return addss(-y,x); }
     642             : 
     643             : INLINE GEN
     644  5257305586 : subii(GEN x, GEN y)
     645             : {
     646  5257305586 :   if (x==y) return gen_0; /* frequent with x = y = gen_0 */
     647  3912857880 :   return addii_sign(x, signe(x), y, -signe(y));
     648             : }
     649             : INLINE GEN
     650  5964800483 : addii(GEN x, GEN y) { return addii_sign(x, signe(x), y, signe(y)); }
     651             : INLINE GEN
     652  1075851729 : addrr(GEN x, GEN y) { return addrr_sign(x, signe(x), y, signe(y)); }
     653             : INLINE GEN
     654  1448350094 : subrr(GEN x, GEN y) { return addrr_sign(x, signe(x), y, -signe(y)); }
     655             : INLINE GEN
     656   214509296 : addir(GEN x, GEN y) { return addir_sign(x, signe(x), y, signe(y)); }
     657             : INLINE GEN
     658   138406877 : subir(GEN x, GEN y) { return addir_sign(x, signe(x), y, -signe(y)); }
     659             : INLINE GEN
     660     1784898 : subri(GEN x, GEN y) { return addir_sign(y, -signe(y), x, signe(x)); }
     661             : INLINE GEN
     662    62542004 : addsi(long x, GEN y) { return addsi_sign(x, y, signe(y)); }
     663             : INLINE GEN
     664    76282319 : addui(ulong x, GEN y) { return addui_sign(x, y, signe(y)); }
     665             : INLINE GEN
     666     6687907 : subsi(long x, GEN y) { return addsi_sign(x, y, -signe(y)); }
     667             : INLINE GEN
     668    47869723 : subui(ulong x, GEN y) { return addui_sign(x, y, -signe(y)); }
     669             : 
     670             : /*******************************************************************/
     671             : /*                                                                 */
     672             : /*                           MOD, REM, DIV                         */
     673             : /*                                                                 */
     674             : /*******************************************************************/
     675    96466753 : INLINE ulong mod2BIL(GEN x) { return *int_LSW(x); }
     676           0 : INLINE long mod64(GEN x) { return mod2BIL(x) & 63; }
     677         259 : INLINE long mod32(GEN x) { return mod2BIL(x) & 31; }
     678      312130 : INLINE long mod16(GEN x) { return mod2BIL(x) & 15; }
     679    48581800 : INLINE long mod8(GEN x)  { return mod2BIL(x) & 7; }
     680     6974010 : INLINE long mod4(GEN x)  { return mod2BIL(x) & 3; }
     681    28168399 : INLINE long mod2(GEN x)  { return mod2BIL(x) & 1; }
     682             : INLINE int
     683    41876469 : mpodd(GEN x) { return signe(x) && mod2(x); }
     684             : /* x mod 2^n, n < BITS_IN_LONG */
     685             : INLINE ulong
     686    17446991 : umodi2n(GEN x, long n)
     687             : {
     688    17446991 :   long s = signe(x);
     689    17446991 :   const ulong _2n = 1UL << n;
     690             :   ulong m;
     691    17446991 :   if (!s) return 0;
     692    17434921 :   m = *int_LSW(x) & (_2n - 1);
     693    17434921 :   if (s < 0 && m) m = _2n - m;
     694    17434921 :   return m;
     695             : }
     696           0 : INLINE ulong Mod64(GEN x){ return umodi2n(x,6); }
     697      167062 : INLINE ulong Mod32(GEN x){ return umodi2n(x,5); }
     698      217049 : INLINE ulong Mod16(GEN x){ return umodi2n(x,4); }
     699     2046163 : INLINE ulong Mod8(GEN x) { return umodi2n(x,3); }
     700    13191117 : INLINE ulong Mod4(GEN x) { return umodi2n(x,2); }
     701     1825474 : INLINE ulong Mod2(GEN x) { return umodi2n(x,1); }
     702             : 
     703             : INLINE GEN
     704    28267887 : truedivii(GEN a,GEN b) { return truedvmdii(a,b,NULL); }
     705             : INLINE GEN
     706       11306 : truedivis(GEN a, long b) { return truedvmdis(a,b,NULL); }
     707             : INLINE GEN
     708     6162526 : truedivsi(long a, GEN b) { return truedvmdsi(a,b,NULL); }
     709             : 
     710             : INLINE GEN
     711     9404641 : divii(GEN a, GEN b) { return dvmdii(a,b,NULL); }
     712             : INLINE GEN
     713  1481017113 : remii(GEN a, GEN b) { return dvmdii(a,b,ONLY_REM); }
     714             : 
     715             : INLINE GEN
     716           0 : divss(long x, long y) { return stoi(x / y); }
     717             : INLINE GEN
     718           0 : modss(long x, long y) { return utoi(smodss(x, y)); }
     719             : INLINE GEN
     720           0 : remss(long x, long y) { return stoi(x % y); }
     721             : INLINE long
     722         595 : smodss(long x, long y)
     723             : {
     724         595 :   long r = x%y;
     725         595 :   return (r >= 0)? r: labs(y) + r;
     726             : }
     727             : INLINE ulong
     728   348847717 : umodsu(long x, ulong y)
     729             : {
     730   348847717 :   return x>=0 ? x%y: Fl_neg((-x)%y, y);
     731             : }
     732             : 
     733             : INLINE long
     734           0 : sdivss_rem(long x, long y, long *r)
     735             : {
     736             :   long q;
     737             :   LOCAL_HIREMAINDER;
     738           0 :   if (!y) pari_err_INV("sdivss_rem",gen_0);
     739           0 :   hiremainder = 0; q = divll((ulong)labs(x),(ulong)labs(y));
     740           0 :   if (x < 0) { hiremainder = -((long)hiremainder); q = -q; }
     741           0 :   if (y < 0) q = -q;
     742           0 :   *r = hiremainder; return q;
     743             : }
     744             : INLINE GEN
     745           0 : divss_rem(long x, long y, long *r) { return stoi(sdivss_rem(x,y,r)); }
     746             : INLINE ulong
     747    68082669 : udivuu_rem(ulong x, ulong y, ulong *r)
     748             : {
     749    68082669 :   if (!y) pari_err_INV("udivuu_rem",gen_0);
     750    68082669 :   *r = x % y; return x / y;
     751             : }
     752             : INLINE ulong
     753      203346 : ceildivuu(ulong a, ulong b)
     754             : {
     755      203346 :   ulong c = a/b;
     756      203346 :   return (a%b)? c+1: c;
     757             : }
     758             : 
     759             : INLINE ulong
     760       11429 : uabsdivui_rem(ulong x, GEN y, ulong *r)
     761             : {
     762       11429 :   long q, s = signe(y);
     763             :   LOCAL_HIREMAINDER;
     764             : 
     765       11429 :   if (!s) pari_err_INV("uabsdivui_rem",gen_0);
     766       11429 :   if (!x || lgefint(y)>3) { *r = x; return 0; }
     767       11128 :   hiremainder=0; q = (long)divll(x, (ulong)y[2]);
     768       11128 :   if (s < 0) q = -q;
     769       11128 :   *r = hiremainder; return q;
     770             : }
     771             : 
     772             : /* assume d != 0 and |n| / d can be represented as an ulong.
     773             :  * Return |n|/d, set *r = |n| % d */
     774             : INLINE ulong
     775    12480475 : uabsdiviu_rem(GEN n, ulong d, ulong *r)
     776             : {
     777    12480475 :   switch(lgefint(n))
     778             :   {
     779           0 :     case 2: *r = 0; return 0;
     780    12480475 :     case 3:
     781             :     {
     782    12480475 :       ulong nn = n[2];
     783    12480475 :       *r = nn % d; return nn / d;
     784             :     }
     785           0 :     default: /* 4 */
     786             :     {
     787             :       ulong n1, n0, q;
     788             :       LOCAL_HIREMAINDER;
     789           0 :       n0 = *int_W(n,0);
     790           0 :       n1 = *int_W(n,1);
     791           0 :       hiremainder = n1;
     792           0 :       q = divll(n0, d);
     793           0 :       *r = hiremainder; return q;
     794             :     }
     795             :   }
     796             : }
     797             : 
     798             : INLINE long
     799    14887917 : sdivsi_rem(long x, GEN y, long *r)
     800             : {
     801    14887917 :   long q, s = signe(y);
     802             :   LOCAL_HIREMAINDER;
     803             : 
     804    14887917 :   if (!s) pari_err_INV("sdivsi_rem",gen_0);
     805    14887918 :   if (!x || lgefint(y)>3 || ((long)y[2]) < 0) { *r = x; return 0; }
     806    12947457 :   hiremainder=0; q = (long)divll(labs(x), (ulong)y[2]);
     807    12947457 :   if (x < 0) { hiremainder = -((long)hiremainder); q = -q; }
     808    12947457 :   if (s < 0) q = -q;
     809    12947457 :   *r = hiremainder; return q;
     810             : }
     811             : INLINE GEN
     812           0 : divsi_rem(long s, GEN y, long *r) { return stoi(sdivsi_rem(s,y,r)); }
     813             : 
     814             : INLINE long
     815         140 : sdivsi(long x, GEN y)
     816             : {
     817         140 :   long q, s = signe(y);
     818             : 
     819         140 :   if (!s) pari_err_INV("sdivsi",gen_0);
     820         140 :   if (!x || lgefint(y)>3 || ((long)y[2]) < 0) return 0;
     821          98 :   q = labs(x) / y[2];
     822          98 :   if (x < 0) q = -q;
     823          98 :   if (s < 0) q = -q;
     824          98 :   return q;
     825             : }
     826             : 
     827             : INLINE GEN
     828           0 : dvmdss(long x, long y, GEN *z)
     829             : {
     830             :   long r;
     831           0 :   GEN q = divss_rem(x,y, &r);
     832           0 :   *z = stoi(r); return q;
     833             : }
     834             : INLINE long
     835  3936549514 : dvmdsBIL(long n, long *r) { *r = remsBIL(n); return divsBIL(n); }
     836             : INLINE ulong
     837   144004119 : dvmduBIL(ulong n, ulong *r) { *r = remsBIL(n); return divsBIL(n); }
     838             : INLINE GEN
     839           0 : dvmdsi(long x, GEN y, GEN *z)
     840             : {
     841             :   long r;
     842           0 :   GEN q = divsi_rem(x,y, &r);
     843           0 :   *z = stoi(r); return q;
     844             : }
     845             : INLINE GEN
     846           0 : dvmdis(GEN x, long y, GEN *z)
     847             : {
     848             :   long r;
     849           0 :   GEN q = divis_rem(x,y, &r);
     850           0 :   *z = stoi(r); return q;
     851             : }
     852             : 
     853             : INLINE long
     854    19630410 : smodis(GEN x, long y)
     855             : {
     856    19630410 :   pari_sp av = avma;
     857    19630410 :   long r; (void)divis_rem(x,y, &r);
     858    19630410 :   return gc_long(av, (r >= 0)? r: labs(y) + r);
     859             : }
     860             : INLINE GEN
     861    19592008 : modis(GEN x, long y) { return stoi(smodis(x,y)); }
     862             : INLINE GEN
     863     8725146 : modsi(long x, GEN y) {
     864     8725146 :   long r; (void)sdivsi_rem(x, y, &r);
     865     8725147 :   return (r >= 0)? stoi(r): addsi_sign(r, y, 1);
     866             : }
     867             : 
     868             : INLINE ulong
     869      816182 : umodui(ulong x, GEN y)
     870             : {
     871      816182 :   if (!signe(y)) pari_err_INV("umodui",gen_0);
     872      816182 :   if (!x || lgefint(y) > 3) return x;
     873      208083 :   return x % (ulong)y[2];
     874             : }
     875             : 
     876             : INLINE ulong
     877       42602 : ugcdiu(GEN x, ulong y) { return ugcd(umodiu(x,y), y); }
     878             : INLINE ulong
     879        4792 : ugcdui(ulong y, GEN x) { return ugcd(umodiu(x,y), y); }
     880             : 
     881             : INLINE GEN
     882           0 : remsi(long x, GEN y)
     883           0 : { long r; (void)sdivsi_rem(x,y, &r); return stoi(r); }
     884             : INLINE GEN
     885           0 : remis(GEN x, long y)
     886             : {
     887           0 :   pari_sp av = avma;
     888             :   long r;
     889           0 :   (void)divis_rem(x,y, &r); set_avma(av); return stoi(r);
     890             : }
     891             : 
     892             : INLINE GEN
     893           0 : rdivis(GEN x, long y, long prec)
     894             : {
     895           0 :   GEN z = cgetr(prec);
     896           0 :   pari_sp av = avma;
     897           0 :   affrr(divrs(itor(x,prec), y),z);
     898           0 :   set_avma(av); return z;
     899             : }
     900             : INLINE GEN
     901           0 : rdivsi(long x, GEN y, long prec)
     902             : {
     903           0 :   GEN z = cgetr(prec);
     904           0 :   pari_sp av = avma;
     905           0 :   affrr(divsr(x, itor(y,prec)), z);
     906           0 :   set_avma(av); return z;
     907             : }
     908             : INLINE GEN
     909      839647 : rdivss(long x, long y, long prec)
     910             : {
     911      839647 :   GEN z = cgetr(prec);
     912      839647 :   pari_sp av = avma;
     913      839647 :   affrr(divrs(stor(x, prec), y), z);
     914      839647 :   set_avma(av); return z;
     915             : }
     916             : 
     917             : INLINE void
     918     6209714 : rdiviiz(GEN x, GEN y, GEN z)
     919             : {
     920     6209714 :   long prec = realprec(z), lx = lgefint(x), ly = lgefint(y);
     921     6209714 :   if (lx == 2) { affur(0, z); return; }
     922     6209714 :   if (ly == 3)
     923             :   {
     924      828814 :     affir(x, z); if (signe(y) < 0) togglesign(z);
     925      828735 :     affrr(divru(z, y[2]), z);
     926             :   }
     927     5380919 :   else if (lx > prec + 1 || ly > prec + 1)
     928             :   {
     929     1728642 :     affir(x,z); affrr(divri(z, y), z);
     930             :   }
     931             :   else
     932             :   {
     933     3652279 :     long b = bit_accuracy(prec) + expi(y) - expi(x) + 1;
     934     3652284 :     GEN q = divii(b > 0? shifti(x, b): x, y);
     935     3652359 :     affir(q, z); if (b > 0) shiftr_inplace(z, -b);
     936             :   }
     937     6209935 :   set_avma((ulong)z);
     938             : }
     939             : INLINE GEN
     940     6192234 : rdivii(GEN x, GEN y, long prec)
     941     6192234 : { GEN z = cgetr(prec); rdiviiz(x, y, z); return z; }
     942             : INLINE GEN
     943     6035284 : fractor(GEN x, long prec)
     944     6035284 : { return rdivii(gel(x,1), gel(x,2), prec); }
     945             : 
     946             : INLINE int
     947     6548014 : dvdii(GEN x, GEN y)
     948             : {
     949     6548014 :   pari_sp av = avma;
     950             :   GEN r;
     951     6548014 :   if (!signe(x)) return 1;
     952     6188394 :   if (!signe(y)) return 0;
     953     6188394 :   r = remii(x,y);
     954     6194853 :   return gc_bool(av, r == gen_0);
     955             : }
     956             : INLINE int
     957          98 : dvdsi(long x, GEN y)
     958             : {
     959          98 :   if (x == 0) return 1;
     960          21 :   if (!signe(y)) return 0;
     961          21 :   if (lgefint(y) != 3) return 0;
     962          21 :   return x % y[2] == 0;
     963             : }
     964             : INLINE int
     965         147 : dvdui(ulong x, GEN y)
     966             : {
     967         147 :   if (x == 0) return 1;
     968         147 :   if (!signe(y)) return 0;
     969         147 :   if (lgefint(y) != 3) return 0;
     970         147 :   return x % y[2] == 0;
     971             : }
     972             : INLINE int
     973        5642 : dvdis(GEN x, long y)
     974        5642 : { return y? smodis(x, y) == 0: signe(x) == 0; }
     975             : INLINE int
     976        5026 : dvdiu(GEN x, ulong y)
     977        5026 : { return y? umodiu(x, y) == 0: signe(x) == 0; }
     978             : 
     979             : INLINE int
     980           0 : dvdisz(GEN x, long y, GEN z)
     981             : {
     982           0 :   const pari_sp av = avma;
     983             :   long r;
     984           0 :   GEN p1 = divis_rem(x,y, &r);
     985           0 :   set_avma(av); if (r) return 0;
     986           0 :   affii(p1,z); return 1;
     987             : }
     988             : INLINE int
     989           0 : dvdiuz(GEN x, ulong y, GEN z)
     990             : {
     991           0 :   const pari_sp av = avma;
     992             :   ulong r;
     993           0 :   GEN p1 = absdiviu_rem(x,y, &r);
     994           0 :   set_avma(av); if (r) return 0;
     995           0 :   affii(p1,z); return 1;
     996             : }
     997             : INLINE int
     998        4146 : dvdiiz(GEN x, GEN y, GEN z)
     999             : {
    1000        4146 :   const pari_sp av=avma;
    1001        4146 :   GEN p2, p1 = dvmdii(x,y,&p2);
    1002        4146 :   if (signe(p2)) return gc_bool(av,0);
    1003        3352 :   affii(p1,z); return gc_bool(av,1);
    1004             : }
    1005             : 
    1006             : INLINE ulong
    1007    67328450 : remlll_pre(ulong u2, ulong u1, ulong u0, ulong n, ulong ninv)
    1008             : {
    1009    67328450 :   u1 = remll_pre(u2, u1, n, ninv);
    1010    68440230 :   return remll_pre(u1, u0, n, ninv);
    1011             : }
    1012             : 
    1013             : INLINE ulong
    1014  1716117004 : Fl_sqr_pre(ulong a, ulong p, ulong pi)
    1015             : {
    1016             :   register ulong x;
    1017             :   LOCAL_HIREMAINDER;
    1018  1716117004 :   x = mulll(a,a);
    1019  1716117004 :   return remll_pre(hiremainder, x, p, pi);
    1020             : }
    1021             : 
    1022             : INLINE ulong
    1023  2607747322 : Fl_mul_pre(ulong a, ulong b, ulong p, ulong pi)
    1024             : {
    1025             :   register ulong x;
    1026             :   LOCAL_HIREMAINDER;
    1027  2607747322 :   x = mulll(a,b);
    1028  2607747322 :   return remll_pre(hiremainder, x, p, pi);
    1029             : }
    1030             : 
    1031             : INLINE ulong
    1032  5376283957 : Fl_addmul_pre(ulong y0, ulong x0, ulong x1, ulong p, ulong pi)
    1033             : {
    1034             :   ulong l0, h0;
    1035             :   LOCAL_HIREMAINDER;
    1036  5376283957 :   hiremainder = y0;
    1037  5376283957 :   l0 = addmul(x0, x1); h0 = hiremainder;
    1038  5376283957 :   return remll_pre(h0, l0, p, pi);
    1039             : }
    1040             : 
    1041             : INLINE ulong
    1042    47723245 : Fl_addmulmul_pre(ulong x0, ulong y0, ulong x1, ulong y1, ulong p, ulong pi)
    1043             : {
    1044             :   ulong l0, l1, h0, h1;
    1045             :   LOCAL_OVERFLOW;
    1046             :   LOCAL_HIREMAINDER;
    1047    47723245 :   l0 = mulll(x0, y0); h0 = hiremainder;
    1048    47723245 :   l1 = mulll(x1, y1); h1 = hiremainder;
    1049    47723245 :   l0 = addll(l0, l1); h0 = addllx(h0, h1);
    1050    47723245 :   return overflow ? remlll_pre(1, h0, l0, p, pi): remll_pre(h0, l0, p, pi);
    1051             : }
    1052             : 
    1053             : INLINE ulong
    1054      190557 : Fl_ellj_pre(ulong a4, ulong a6, ulong p, ulong pi)
    1055             : {
    1056             :   /* a43 = 4 a4^3 */
    1057      190557 :   ulong a43 = Fl_double(Fl_double(
    1058             :               Fl_mul_pre(a4, Fl_sqr_pre(a4, p, pi), p, pi), p), p);
    1059             :   /* a62 = 27 a6^2 */
    1060      190561 :   ulong a62 = Fl_mul_pre(Fl_sqr_pre(a6, p, pi), 27 % p, p, pi);
    1061      190560 :   ulong z1 = Fl_mul_pre(a43, 1728 % p, p, pi);
    1062      190558 :   ulong z2 = Fl_add(a43, a62, p);
    1063      190558 :   return Fl_div(z1, z2, p);
    1064             : }
    1065             : 
    1066             : /*******************************************************************/
    1067             : /*                                                                 */
    1068             : /*                        MP (INT OR REAL)                         */
    1069             : /*                                                                 */
    1070             : /*******************************************************************/
    1071             : INLINE GEN
    1072          21 : mptrunc(GEN x) { return typ(x)==t_INT? icopy(x): truncr(x); }
    1073             : INLINE GEN
    1074           0 : mpfloor(GEN x) { return typ(x)==t_INT? icopy(x): floorr(x); }
    1075             : INLINE GEN
    1076           0 : mpceil(GEN x) { return typ(x)==t_INT? icopy(x): ceilr(x); }
    1077             : INLINE GEN
    1078     1314534 : mpround(GEN x) { return typ(x) == t_INT? icopy(x): roundr(x); }
    1079             : 
    1080             : INLINE long
    1081      260423 : mpexpo(GEN x) { return typ(x) == t_INT? expi(x): expo(x); }
    1082             : 
    1083             : INLINE GEN
    1084    74026111 : mpadd(GEN x, GEN y)
    1085             : {
    1086    74026111 :   if (typ(x)==t_INT)
    1087    15534886 :     return (typ(y)==t_INT) ? addii(x,y) : addir(x,y);
    1088    58491225 :   return (typ(y)==t_INT) ? addir(y,x) : addrr(x,y);
    1089             : }
    1090             : INLINE GEN
    1091    37158599 : mpsub(GEN x, GEN y)
    1092             : {
    1093    37158599 :   if (typ(x)==t_INT)
    1094      207923 :     return (typ(y)==t_INT) ? subii(x,y) : subir(x,y);
    1095    36950676 :   return (typ(y)==t_INT) ? subri(x,y) : subrr(x,y);
    1096             : }
    1097             : INLINE GEN
    1098   108637288 : mpmul(GEN x, GEN y)
    1099             : {
    1100   108637288 :   if (typ(x)==t_INT)
    1101    24245854 :     return (typ(y)==t_INT) ? mulii(x,y) : mulir(x,y);
    1102    84391434 :   return (typ(y)==t_INT) ? mulir(y,x) : mulrr(x,y);
    1103             : }
    1104             : INLINE GEN
    1105    15187722 : mpsqr(GEN x) { return (typ(x)==t_INT) ? sqri(x) : sqrr(x); }
    1106             : INLINE GEN
    1107      407147 : mpdiv(GEN x, GEN y)
    1108             : {
    1109      407147 :   if (typ(x)==t_INT)
    1110      106924 :     return (typ(y)==t_INT) ? divii(x,y) : divir(x,y);
    1111      300223 :   return (typ(y)==t_INT) ? divri(x,y) : divrr(x,y);
    1112             : }
    1113             : 
    1114             : /*******************************************************************/
    1115             : /*                                                                 */
    1116             : /*                          Z/nZ, n ULONG                          */
    1117             : /*                                                                 */
    1118             : /*******************************************************************/
    1119             : INLINE ulong
    1120   364538816 : Fl_double(ulong a, ulong p)
    1121             : {
    1122   364538816 :   ulong res = a << 1;
    1123   364538816 :   return (res >= p || res < a) ? res - p : res;
    1124             : }
    1125             : INLINE ulong
    1126    70519696 : Fl_triple(ulong a, ulong p)
    1127             : {
    1128    70519696 :   ulong res = a << 1;
    1129    70519696 :   if (res >= p || res < a) res -= p;
    1130    70519696 :   res += a;
    1131    70519696 :   return (res >= p || res < a)? res - p: res;
    1132             : }
    1133             : INLINE ulong
    1134    14071306 : Fl_halve(ulong a, ulong p)
    1135             : {
    1136             :   ulong ap, ap2;
    1137    14071306 :   if ((a&1UL)==0) return a>>1;
    1138     7083404 :   ap = a + p; ap2 = ap>>1;
    1139     7083404 :   return ap>=a ? ap2: (ap2|HIGHBIT);
    1140             : }
    1141             : 
    1142             : INLINE ulong
    1143  2892342501 : Fl_add(ulong a, ulong b, ulong p)
    1144             : {
    1145  2892342501 :   ulong res = a + b;
    1146  2892342501 :   return (res >= p || res < a) ? res - p : res;
    1147             : }
    1148             : INLINE ulong
    1149   281394654 : Fl_neg(ulong x, ulong p) { return x ? p - x: 0; }
    1150             : 
    1151             : INLINE ulong
    1152  4717512834 : Fl_sub(ulong a, ulong b, ulong p)
    1153             : {
    1154  4717512834 :   ulong res = a - b;
    1155  4717512834 :   return (res > a) ? res + p: res;
    1156             : }
    1157             : 
    1158             : /* centerlift(u mod p) */
    1159             : INLINE long
    1160     2782612 : Fl_center(ulong u, ulong p, ulong ps2) { return (long) (u > ps2)? u - p: u; }
    1161             : 
    1162             : INLINE ulong
    1163   781634397 : Fl_mul(ulong a, ulong b, ulong p)
    1164             : {
    1165             :   register ulong x;
    1166             :   LOCAL_HIREMAINDER;
    1167   781634397 :   x = mulll(a,b);
    1168   781634397 :   if (!hiremainder) return x % p;
    1169   146507653 :   (void)divll(x,p); return hiremainder;
    1170             : }
    1171             : INLINE ulong
    1172    63327409 : Fl_sqr(ulong a, ulong p)
    1173             : {
    1174             :   register ulong x;
    1175             :   LOCAL_HIREMAINDER;
    1176    63327409 :   x = mulll(a,a);
    1177    63327409 :   if (!hiremainder) return x % p;
    1178    33645541 :   (void)divll(x,p); return hiremainder;
    1179             : }
    1180             : /* don't assume that p is prime: can't special case a = 0 */
    1181             : INLINE ulong
    1182    10509443 : Fl_div(ulong a, ulong b, ulong p)
    1183    10509443 : { return Fl_mul(a, Fl_inv(b, p), p); }
    1184             : 
    1185             : /*******************************************************************/
    1186             : /*                                                                 */
    1187             : /*        DEFINED FROM EXISTING ONE EXPLOITING COMMUTATIVITY       */
    1188             : /*                                                                 */
    1189             : /*******************************************************************/
    1190             : INLINE GEN
    1191      336327 : addri(GEN x, GEN y) { return addir(y,x); }
    1192             : INLINE GEN
    1193    50259985 : addis(GEN x, long s) { return addsi(s,x); }
    1194             : INLINE GEN
    1195    75451955 : addiu(GEN x, ulong s) { return addui(s,x); }
    1196             : INLINE GEN
    1197     2863575 : addrs(GEN x, long s) { return addsr(s,x); }
    1198             : 
    1199             : INLINE GEN
    1200    44584452 : subiu(GEN x, long y) { GEN z = subui(y, x); togglesign(z); return z; }
    1201             : INLINE GEN
    1202        2087 : subis(GEN x, long y) { return addsi(-y,x); }
    1203             : INLINE GEN
    1204     3238496 : subrs(GEN x, long y) { return addsr(-y,x); }
    1205             : 
    1206             : INLINE GEN
    1207   201684161 : mulis(GEN x, long s) { return mulsi(s,x); }
    1208             : INLINE GEN
    1209   150925834 : muliu(GEN x, ulong s) { return mului(s,x); }
    1210             : INLINE GEN
    1211     3080649 : mulru(GEN x, ulong s) { return mulur(s,x); }
    1212             : INLINE GEN
    1213    21574659 : mulri(GEN x, GEN s) { return mulir(s,x); }
    1214             : INLINE GEN
    1215    10271204 : mulrs(GEN x, long s) { return mulsr(s,x); }
    1216             : 
    1217             : /*******************************************************************/
    1218             : /*                                                                 */
    1219             : /*                  VALUATION, EXPONENT, SHIFTS                    */
    1220             : /*                                                                 */
    1221             : /*******************************************************************/
    1222             : INLINE long
    1223    84290850 : vali(GEN x)
    1224             : {
    1225             :   long i;
    1226             :   GEN xp;
    1227             : 
    1228    84290850 :   if (!signe(x)) return -1;
    1229    84284123 :   xp=int_LSW(x);
    1230    88963144 :   for (i=0; !*xp; i++) xp=int_nextW(xp);
    1231    84284123 :   return vals(*xp) + i * BITS_IN_LONG;
    1232             : }
    1233             : 
    1234             : /* assume x > 0 */
    1235             : INLINE long
    1236   370573398 : expu(ulong x) { return (BITS_IN_LONG-1) - (long)bfffo(x); }
    1237             : 
    1238             : INLINE long
    1239   842608220 : expi(GEN x)
    1240             : {
    1241   842608220 :   const long lx=lgefint(x);
    1242   842608220 :   return lx==2? -(long)HIGHEXPOBIT: bit_accuracy(lx)-(long)bfffo(*int_MSW(x))-1;
    1243             : }
    1244             : 
    1245             : INLINE GEN
    1246    65606196 : shiftr(GEN x, long n)
    1247             : {
    1248    65606196 :   const long e = evalexpo(expo(x)+n);
    1249    65603640 :   const GEN y = rcopy(x);
    1250             : 
    1251    65597925 :   if (e & ~EXPOBITS) pari_err_OVERFLOW("expo()");
    1252    65597356 :   y[1] = (y[1]&~EXPOBITS) | e; return y;
    1253             : }
    1254             : INLINE GEN
    1255    23923628 : mpshift(GEN x,long s) { return (typ(x)==t_INT)?shifti(x,s):shiftr(x,s); }
    1256             : 
    1257             : /* FIXME: adapt/use mpn_[lr]shift instead */
    1258             : /* z2[imin..imax] := z1[imin..imax].f shifted left sh bits
    1259             :  * (feeding f from the right). Assume sh > 0 */
    1260             : INLINE void
    1261  3767255508 : shift_left(GEN z2, GEN z1, long imin, long imax, ulong f,  ulong sh)
    1262             : {
    1263  3767255508 :   GEN sb = z1 + imin, se = z1 + imax, te = z2 + imax;
    1264  3767255508 :   ulong l, m = BITS_IN_LONG - sh, k = f >> m;
    1265 18343676143 :   while (se > sb) {
    1266 14576420635 :     l     = *se--;
    1267 14576420635 :     *te-- = (l << sh) | k;
    1268 14576420635 :     k     = l >> m;
    1269             :   }
    1270  3767255508 :   *te = (((ulong)*se) << sh) | k;
    1271  3767255508 : }
    1272             : /* z2[imin..imax] := f.z1[imin..imax-1] shifted right sh bits
    1273             :  * (feeding f from the left). Assume sh > 0 */
    1274             : INLINE void
    1275  3510695342 : shift_right(GEN z2, GEN z1, long imin, long imax, ulong f, ulong sh)
    1276             : {
    1277  3510695342 :   GEN sb = z1 + imin, se = z1 + imax, tb = z2 + imin;
    1278  3510695342 :   ulong k, l = *sb++, m = BITS_IN_LONG - sh;
    1279  3510695342 :   *tb++ = (l >> sh) | (f << m);
    1280 15490559675 :   while (sb < se) {
    1281 11979864333 :     k     = l << m;
    1282 11979864333 :     l     = *sb++;
    1283 11979864333 :     *tb++ = (l >> sh) | k;
    1284             :   }
    1285  3510695342 : }
    1286             : 
    1287             : /* Backward compatibility. Inefficient && unused */
    1288             : extern ulong hiremainder;
    1289             : INLINE ulong
    1290           0 : shiftl(ulong x, ulong y)
    1291           0 : { hiremainder = x>>(BITS_IN_LONG-y); return (x<<y); }
    1292             : 
    1293             : INLINE ulong
    1294           0 : shiftlr(ulong x, ulong y)
    1295           0 : { hiremainder = x<<(BITS_IN_LONG-y); return (x>>y); }
    1296             : 
    1297             : INLINE void
    1298   100859384 : shiftr_inplace(GEN z, long d)
    1299             : {
    1300   100859384 :   setexpo(z, expo(z)+d);
    1301   100858336 : }
    1302             : 
    1303             : /*******************************************************************/
    1304             : /*                                                                 */
    1305             : /*                           ASSIGNMENT                            */
    1306             : /*                                                                 */
    1307             : /*******************************************************************/
    1308             : INLINE void
    1309   109593271 : affii(GEN x, GEN y)
    1310             : {
    1311   109593271 :   long lx = lgefint(x);
    1312   109593271 :   if (lg(y)<lx) pari_err_OVERFLOW("t_INT-->t_INT assignment");
    1313  3789514705 :   while (--lx) y[lx] = x[lx];
    1314   109593282 : }
    1315             : INLINE void
    1316      576556 : affsi(long s, GEN x)
    1317             : {
    1318      576556 :   if (!s) x[1] = evalsigne(0) | evallgefint(2);
    1319             :   else
    1320             :   {
    1321      544133 :     if (s > 0) { x[1] = evalsigne( 1) | evallgefint(3); x[2] =  s; }
    1322      208935 :     else       { x[1] = evalsigne(-1) | evallgefint(3); x[2] = -s; }
    1323             :   }
    1324      576556 : }
    1325             : INLINE void
    1326     8404767 : affui(ulong u, GEN x)
    1327             : {
    1328     8404767 :   if (!u) x[1] = evalsigne(0) | evallgefint(2);
    1329     8403836 :   else  { x[1] = evalsigne(1) | evallgefint(3); x[2] = u; }
    1330     8404767 : }
    1331             : 
    1332             : INLINE void
    1333   169431823 : affsr(long x, GEN y)
    1334             : {
    1335   169431823 :   long sh, i, ly = lg(y);
    1336             : 
    1337   169431823 :   if (!x)
    1338             :   {
    1339       70966 :     y[1] = evalexpo(-prec2nbits(ly));
    1340       70966 :     return;
    1341             :   }
    1342   169360857 :   if (x < 0) {
    1343        4123 :     x = -x; sh = bfffo(x);
    1344        4123 :     y[1] = evalsigne(-1) | _evalexpo((BITS_IN_LONG-1)-sh);
    1345             :   }
    1346             :   else
    1347             :   {
    1348   169356734 :     sh = bfffo(x);
    1349   169356734 :     y[1] = evalsigne(1) | _evalexpo((BITS_IN_LONG-1)-sh);
    1350             :   }
    1351  1037632308 :   y[2] = ((ulong)x)<<sh; for (i=3; i<ly; i++) y[i]=0;
    1352             : }
    1353             : 
    1354             : INLINE void
    1355     8737477 : affur(ulong x, GEN y)
    1356             : {
    1357     8737477 :   long sh, i, ly = lg(y);
    1358             : 
    1359     8737477 :   if (!x)
    1360             :   {
    1361     1299414 :     y[1] = evalexpo(-prec2nbits(ly));
    1362     1299414 :     return;
    1363             :   }
    1364     7438063 :   sh = bfffo(x);
    1365     7438063 :   y[1] = evalsigne(1) | _evalexpo((BITS_IN_LONG-1)-sh);
    1366    26647918 :   y[2] = x<<sh; for (i=3; i<ly; i++) y[i] = 0;
    1367             : }
    1368             : 
    1369             : INLINE void
    1370      263110 : affiz(GEN x, GEN y) { if (typ(y)==t_INT) affii(x,y); else affir(x,y); }
    1371             : INLINE void
    1372           0 : affsz(long x, GEN y) { if (typ(y)==t_INT) affsi(x,y); else affsr(x,y); }
    1373             : INLINE void
    1374      656715 : mpaff(GEN x, GEN y) { if (typ(x)==t_INT) affiz(x, y); else affrr(x,y); }
    1375             : 
    1376             : /*******************************************************************/
    1377             : /*                                                                 */
    1378             : /*                    OPERATION + ASSIGNMENT                       */
    1379             : /*                                                                 */
    1380             : /*******************************************************************/
    1381             : 
    1382           0 : INLINE void addiiz(GEN x, GEN y, GEN z)
    1383           0 : { pari_sp av = avma; affii(addii(x,y),z); set_avma(av); }
    1384           0 : INLINE void addirz(GEN x, GEN y, GEN z)
    1385           0 : { pari_sp av = avma; affrr(addir(x,y),z); set_avma(av); }
    1386           0 : INLINE void addriz(GEN x, GEN y, GEN z)
    1387           0 : { pari_sp av = avma; affrr(addri(x,y),z); set_avma(av); }
    1388     1307078 : INLINE void addrrz(GEN x, GEN y, GEN z)
    1389     1307078 : { pari_sp av = avma; affrr(addrr(x,y),z); set_avma(av); }
    1390           0 : INLINE void addsiz(long s, GEN y, GEN z)
    1391           0 : { pari_sp av = avma; affii(addsi(s,y),z); set_avma(av); }
    1392           0 : INLINE void addsrz(long s, GEN y, GEN z)
    1393           0 : { pari_sp av = avma; affrr(addsr(s,y),z); set_avma(av); }
    1394           0 : INLINE void addssz(long s, long y, GEN z)
    1395           0 : { pari_sp av = avma; affii(addss(s,y),z); set_avma(av); }
    1396             : 
    1397           0 : INLINE void diviiz(GEN x, GEN y, GEN z)
    1398           0 : { pari_sp av = avma; affii(divii(x,y),z); set_avma(av); }
    1399           0 : INLINE void divirz(GEN x, GEN y, GEN z)
    1400           0 : { pari_sp av = avma; mpaff(divir(x,y),z); set_avma(av); }
    1401           0 : INLINE void divisz(GEN x, long y, GEN z)
    1402           0 : { pari_sp av = avma; affii(divis(x,y),z); set_avma(av); }
    1403           0 : INLINE void divriz(GEN x, GEN y, GEN z)
    1404           0 : { pari_sp av = avma; affrr(divri(x,y),z); set_avma(av); }
    1405         409 : INLINE void divrrz(GEN x, GEN y, GEN z)
    1406         409 : { pari_sp av = avma; affrr(divrr(x,y),z); set_avma(av); }
    1407           0 : INLINE void divrsz(GEN y, long s, GEN z)
    1408           0 : { pari_sp av = avma; affrr(divrs(y,s),z); set_avma(av); }
    1409           0 : INLINE void divsiz(long x, GEN y, GEN z)
    1410           0 : { long junk; affsi(sdivsi_rem(x,y,&junk), z); }
    1411           0 : INLINE void divsrz(long s, GEN y, GEN z)
    1412           0 : { pari_sp av = avma; mpaff(divsr(s,y),z); set_avma(av); }
    1413           0 : INLINE void divssz(long x, long y, GEN z)
    1414           0 : { affsi(x/y, z); }
    1415             : 
    1416           0 : INLINE void modisz(GEN y, long s, GEN z)
    1417           0 : { affsi(smodis(y,s),z); }
    1418           0 : INLINE void modsiz(long s, GEN y, GEN z)
    1419           0 : { pari_sp av = avma; affii(modsi(s,y),z); set_avma(av); }
    1420           0 : INLINE void modssz(long s, long y, GEN z)
    1421           0 : { affsi(smodss(s,y),z); }
    1422             : 
    1423           0 : INLINE void mpaddz(GEN x, GEN y, GEN z)
    1424           0 : { pari_sp av = avma; mpaff(mpadd(x,y),z); set_avma(av); }
    1425           0 : INLINE void mpsubz(GEN x, GEN y, GEN z)
    1426           0 : { pari_sp av = avma; mpaff(mpsub(x,y),z); set_avma(av); }
    1427           0 : INLINE void mpmulz(GEN x, GEN y, GEN z)
    1428           0 : { pari_sp av = avma; mpaff(mpmul(x,y),z); set_avma(av); }
    1429             : 
    1430           0 : INLINE void muliiz(GEN x, GEN y, GEN z)
    1431           0 : { pari_sp av = avma; affii(mulii(x,y),z); set_avma(av); }
    1432           0 : INLINE void mulirz(GEN x, GEN y, GEN z)
    1433           0 : { pari_sp av = avma; mpaff(mulir(x,y),z); set_avma(av); }
    1434           0 : INLINE void mulriz(GEN x, GEN y, GEN z)
    1435           0 : { pari_sp av = avma; mpaff(mulri(x,y),z); set_avma(av); }
    1436      260344 : INLINE void mulrrz(GEN x, GEN y, GEN z)
    1437      260344 : { pari_sp av = avma; affrr(mulrr(x,y),z); set_avma(av); }
    1438           0 : INLINE void mulsiz(long s, GEN y, GEN z)
    1439           0 : { pari_sp av = avma; affii(mulsi(s,y),z); set_avma(av); }
    1440           0 : INLINE void mulsrz(long s, GEN y, GEN z)
    1441           0 : { pari_sp av = avma; mpaff(mulsr(s,y),z); set_avma(av); }
    1442           0 : INLINE void mulssz(long s, long y, GEN z)
    1443           0 : { pari_sp av = avma; affii(mulss(s,y),z); set_avma(av); }
    1444             : 
    1445           0 : INLINE void remiiz(GEN x, GEN y, GEN z)
    1446           0 : { pari_sp av = avma; affii(remii(x,y),z); set_avma(av); }
    1447           0 : INLINE void remisz(GEN y, long s, GEN z)
    1448           0 : { pari_sp av = avma; affii(remis(y,s),z); set_avma(av); }
    1449           0 : INLINE void remsiz(long s, GEN y, GEN z)
    1450           0 : { pari_sp av = avma; affii(remsi(s,y),z); set_avma(av); }
    1451           0 : INLINE void remssz(long s, long y, GEN z)
    1452           0 : { pari_sp av = avma; affii(remss(s,y),z); set_avma(av); }
    1453             : 
    1454           0 : INLINE void subiiz(GEN x, GEN y, GEN z)
    1455           0 : { pari_sp av = avma; affii(subii(x,y),z); set_avma(av); }
    1456           0 : INLINE void subirz(GEN x, GEN y, GEN z)
    1457           0 : { pari_sp av = avma; affrr(subir(x,y),z); set_avma(av); }
    1458           0 : INLINE void subisz(GEN y, long s, GEN z)
    1459           0 : { pari_sp av = avma; affii(addsi(-s,y),z); set_avma(av); }
    1460           0 : INLINE void subriz(GEN x, GEN y, GEN z)
    1461           0 : { pari_sp av = avma; affrr(subri(x,y),z); set_avma(av); }
    1462     1296706 : INLINE void subrrz(GEN x, GEN y, GEN z)
    1463     1296706 : { pari_sp av = avma; affrr(subrr(x,y),z); set_avma(av); }
    1464           0 : INLINE void subrsz(GEN y, long s, GEN z)
    1465           0 : { pari_sp av = avma; affrr(addsr(-s,y),z); set_avma(av); }
    1466           0 : INLINE void subsiz(long s, GEN y, GEN z)
    1467           0 : { pari_sp av = avma; affii(subsi(s,y),z); set_avma(av); }
    1468           0 : INLINE void subsrz(long s, GEN y, GEN z)
    1469           0 : { pari_sp av = avma; affrr(subsr(s,y),z); set_avma(av); }
    1470           0 : INLINE void subssz(long x, long y, GEN z) { addssz(x,-y,z); }
    1471             : 
    1472             : INLINE void
    1473           0 : dvmdssz(long x, long y, GEN z, GEN t) {
    1474           0 :   pari_sp av = avma;
    1475             :   long r;
    1476           0 :   affii(divss_rem(x,y, &r), z); set_avma(av); affsi(r,t);
    1477           0 : }
    1478             : INLINE void
    1479           0 : dvmdsiz(long x, GEN y, GEN z, GEN t) {
    1480           0 :   pari_sp av = avma;
    1481             :   long r;
    1482           0 :   affii(divsi_rem(x,y, &r), z); set_avma(av); affsi(r,t);
    1483           0 : }
    1484             : INLINE void
    1485           0 : dvmdisz(GEN x, long y, GEN z, GEN t) {
    1486           0 :   pari_sp av = avma;
    1487             :   long r;
    1488           0 :   affii(divis_rem(x,y, &r),z); set_avma(av); affsi(r,t);
    1489           0 : }
    1490             : INLINE void
    1491           0 : dvmdiiz(GEN x, GEN y, GEN z, GEN t) {
    1492           0 :   pari_sp av = avma;
    1493             :   GEN r;
    1494           0 :   affii(dvmdii(x,y,&r),z); affii(r,t); set_avma(av);
    1495           0 : }

Generated by: LCOV version 1.13