rem
stringlengths 0
83.5k
| add
stringlengths 0
223k
| context
stringlengths 10
471k
| meta
stringlengths 120
236
|
---|---|---|---|
_CPU_ISR_Disable(level); | int BSP_install_rtems_shared_irq_handler (const rtems_irq_connect_data* irq){ unsigned int level; rtems_irq_connect_data* vchain; if (!isValidInterrupt(irq->name)) { printk("Invalid interrupt vector %d\n",irq->name); return 0; } if ( (int)rtems_hdl_tbl[irq->name].next_handler == -1 ) { printk("IRQ vector %d already connected to an unshared handler\n",irq->name); return 0; } _CPU_ISR_Disable(level); vchain = (rtems_irq_connect_data*)malloc(sizeof(rtems_irq_connect_data)); /* save off topmost handler */ vchain[0]= rtems_hdl_tbl[irq->name]; /* * store the data provided by user */ rtems_hdl_tbl[irq->name] = *irq; /* link chain to new topmost handler */ rtems_hdl_tbl[irq->name].next_handler = (void *)vchain; if (is_isa_irq(irq->name)) { /* * Enable interrupt at PIC level */ BSP_irq_enable_at_i8259s (irq->name); } if (is_pci_irq(irq->name)) { /* * Enable interrupt at OPENPIC level */ openpic_enable_irq ((int) irq->name - BSP_PCI_IRQ_LOWEST_OFFSET); } if (is_processor_irq(irq->name)) { /* * Enable exception at processor level */ } /* * Enable interrupt on device */ irq->on(irq); _CPU_ISR_Enable(level); return 1;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/fe235a1e289d4ae8be6825180c6aec29cd704298/irq.c/buggy/c/src/lib/libbsp/powerpc/shared/irq/irq.c |
|
y=cgetg(3,t_COMPLEX); y[2]=larg(x,prec); av=avma; p1=glog(gnorm(x),prec); tetpil=avma; y[1]=lpile(av,tetpil,gmul2n(p1,-1)); return y; | if (gcmp0((GEN)x[2])) return glog((GEN)x[1], prec); if (prec > LOGAGMCX_LIMIT) return logagmcx(x, prec); y = cgetg(3,t_COMPLEX); y[2] = larg(x,prec); av = avma; p1 = glog(cxnorm(x),prec); tetpil = avma; y[1] = lpile(av,tetpil,gmul2n(p1,-1)); return y; | glog(GEN x, long prec){ pari_sp av, tetpil; GEN y, p1; switch(typ(x)) { case t_REAL: if (signe(x) >= 0) { if (!signe(x)) err(talker,"zero argument in mplog"); return logr_abs(x); } y = cgetg(3,t_COMPLEX); y[1] = (long)logr_abs(x); y[2] = lmppi(lg(x)); return y; case t_COMPLEX: y=cgetg(3,t_COMPLEX); y[2]=larg(x,prec); av=avma; p1=glog(gnorm(x),prec); tetpil=avma; y[1]=lpile(av,tetpil,gmul2n(p1,-1)); return y; case t_PADIC: return palog(x); case t_INTMOD: err(typeer,"glog"); default: av = avma; if (!(y = _toser(x))) break; if (valp(y) || gcmp0(y)) err(talker,"log is not meromorphic at 0"); p1 = integ(gdiv(derivser(y), y), varn(y)); /* log(y)' = y'/y */ if (!gcmp1((GEN)y[2])) p1 = gadd(p1, glog((GEN)y[2],prec)); return gerepileupto(av, p1); } return transc(glog,x,prec);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans1.c/buggy/src/basemath/trans1.c |
GEN z, y = cgetr(lg(x)); pari_sp av = avma; z = (s<0)? negr(x): x; z = mplog( addrr(z, sqrtr( addrs(mulrr(z,z), 1) )) ); | GEN z = (s<0)? negr(x): x; z = logr_abs( addrr(z, sqrtr( addrs(mulrr(z,z), 1) )) ); | mpash(GEN x){ long s = signe(x); GEN z, y = cgetr(lg(x)); pari_sp av = avma; z = (s<0)? negr(x): x; z = mplog( addrr(z, sqrtr( addrs(mulrr(z,z), 1) )) ); if (s<0) setsigne(z, -signe(z)); affrr(z,y); avma = av; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
affrr(z,y); avma = av; return y; | return gerepileuptoleaf(av, z); | mpash(GEN x){ long s = signe(x); GEN z, y = cgetr(lg(x)); pari_sp av = avma; z = (s<0)? negr(x): x; z = mplog( addrr(z, sqrtr( addrs(mulrr(z,z), 1) )) ); if (s<0) setsigne(z, -signe(z)); affrr(z,y); avma = av; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
if (expo(x) < 0) { y = cgetr(lg(x)); av = avma; affrr(mpasin(x), y); avma = av; return y; } | if (expo(x) < 0) { av = avma; return gerepileuptoleaf(av, mpasin(x)); } | gasin(GEN x, long prec){ long sx; pari_sp av; GEN a, y, p1; switch(typ(x)) { case t_REAL: sx = signe(x); if (!sx) return realzero_bit(expo(x)); if (absrnz_egal1(x)) { /* |x| = 1 */ if (sx > 0) return Pi2n(-1, lg(x)); /* 1 */ y = Pi2n(-1, lg(x)); setsigne(y, -1); return y; /* -1 */ } if (expo(x) < 0) { y = cgetr(lg(x)); av = avma; affrr(mpasin(x), y); avma = av; return y; } y = cgetg(3,t_COMPLEX); y[1] = (long)Pi2n(-1, lg(x)); y[2] = (long)mpach(x, 1); if (sx < 0) { setsigne(y[1],-signe(y[1])); setsigne(y[2],-signe(y[2])); } return y; case t_COMPLEX: av = avma; p1 = cgetg(3,t_COMPLEX); p1[1] = (long)gneg_i((GEN)x[2]); p1[2] = x[1]; y=gerepileupto(av, gash(p1,prec)); p1 = (GEN)y[1]; y[1] = y[2]; y[2] = (long)p1; setsigne(p1, -signe(p1)); return y; case t_INTMOD: case t_PADIC: err(typeer,"gasin"); default: av = avma; if (!(y = _toser(x))) break; if (gcmp0(y)) return gcopy(y); /* lg(y) > 2*/ if (valp(y) < 0) err(negexper,"gasin"); p1 = gdiv(derivser(y), gsqrt(gsubsg(1,gsqr(y)),prec)); a = integ(p1,varn(y)); if (!valp(y)) a = gadd(a, gasin((GEN)y[2],prec)); return gerepileupto(av, a); } return transc(gasin,x,prec);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
long l = lg(x); GEN z, y = cgetr(l); | mpach(GEN x, long s){ long l = lg(x); GEN z, y = cgetr(l); pari_sp av = avma; if (s != signe(x)) { x = rcopy(x); setsigne(x, s); } z = mplog( addrr(x, sqrtr( subrs(mulrr(x,x), 1) )) ); affrr(z,y); avma = av; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
|
if (s != signe(x)) { x = rcopy(x); setsigne(x, s); } z = mplog( addrr(x, sqrtr( subrs(mulrr(x,x), 1) )) ); affrr(z,y); avma = av; return y; | GEN z = logr_abs( addrr_sign(x, s, sqrtr( subrs(mulrr(x,x), 1) ), 1) ); return gerepileuptoleaf(av, z); | mpach(GEN x, long s){ long l = lg(x); GEN z, y = cgetr(l); pari_sp av = avma; if (s != signe(x)) { x = rcopy(x); setsigne(x, s); } z = mplog( addrr(x, sqrtr( subrs(mulrr(x,x), 1) )) ); affrr(z,y); avma = av; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
long l = lg(x); GEN y = cgetr(l); | mpacos(GEN x){ long l = lg(x); GEN y = cgetr(l); pari_sp av = avma; affrr( subrr(Pi2n(-1,l), mpasin(x)), y ); avma = av; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
|
affrr( subrr(Pi2n(-1,l), mpasin(x)), y ); avma = av; return y; | return gerepileuptoleaf(av, subrr(Pi2n(-1,lg(x)), mpasin(x))); | mpacos(GEN x){ long l = lg(x); GEN y = cgetr(l); pari_sp av = avma; affrr( subrr(Pi2n(-1,l), mpasin(x)), y ); avma = av; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
errno = ENOSYS; return -1; | off_t status; status = lseek( dirp->dd_fd, 0, SEEK_SET ); if( status == -1 ) return; dirp->dd_loc = 0; | void rewinddir( DIR *dirp){ errno = ENOSYS; return -1;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/07a3253de2c3f9bc2d96a351680ec72548dadd2d/rewinddir.c/buggy/cpukit/libcsupport/src/rewinddir.c |
if (!signe(x)) { y=cgetr(3); y[1] = evalexpo((expo(x)<<1) - 1); y[2] = 0; *ptmod8=0; return y; } | if (!signe(x)) { *ptmod8=0; return realzero_bit((expo(x)<<1) - 1); } | mpsc1(GEN x, long *ptmod8){ const long mmax = 23169; /* on a 64-bit machine with true 128 bit/64 bit division, one could * take mmax=1518500248; on the alpha it does not seem worthwhile */ long l,l0,l1,l2,l4,ee,i,n,m,s,t,av; double alpha,beta,a,b,c,d; GEN y,p1,p2,p3,p4,pitemp; if (typ(x)!=t_REAL) err(typeer,"mpsc1"); if (!signe(x)) { y=cgetr(3); y[1] = evalexpo((expo(x)<<1) - 1); y[2] = 0; *ptmod8=0; return y; } l=lg(x); y=cgetr(l); av=avma; l++; pitemp = mppi(l+1); setexpo(pitemp,-1); p1 = addrr(x,pitemp); setexpo(pitemp,0); if (expo(p1) >= bit_accuracy(min(l,lg(p1))) + 3) err(precer,"mpsc1"); p3 = divrr(p1,pitemp); p2 = mpent(p3); if (signe(p2)) x = subrr(x, mulir(p2,pitemp)); p1 = cgetr(l+1); affrr(x, p1); *ptmod8 = (signe(p1) < 0)? 4: 0; if (signe(p2)) { long mod4 = mod4(p2); if (signe(p2) < 0 && mod4) mod4 = 4-mod4; *ptmod8 += mod4; } if (gcmp0(p1)) alpha=1000000.0; else { m=expo(p1); alpha=(m<-1022)? -1-m*LOG2: -1-log(fabs(rtodbl(p1))); } beta = 5 + bit_accuracy(l)*LOG2; a=0.5/LOG2; b=0.5*a; c = a+sqrt((beta+b)/LOG2); d = ((beta/c)-alpha-log(c))/LOG2; if (d>=0) { m=(long)(1+d); n=(long)((1+c)/2.0); setexpo(p1,expo(p1)-m); } else { m=0; n=(long)((1+beta/alpha)/2.0); } l2=l+1+(m>>TWOPOTBITS_IN_LONG); p2=realun(l2); setlg(p2,4); p4=cgetr(l2); av = avma; affrr(gsqr(p1),p4); setlg(p4,4); if (n>mmax) p3 = divrs(divrs(p4,2*n+2),2*n+1); else p3 = divrs(p4, (2*n+2)*(2*n+1)); ee = -expo(p3); s=0; l4 = l1 = 3 + (ee>>TWOPOTBITS_IN_LONG); if (l4<=l2) { setlg(p2,l4); setlg(p4,l4); } for (i=n; i>mmax; i--) { p3 = divrs(divrs(p4,2*i),2*i-1); s -= expo(p3); t=s&(BITS_IN_LONG-1); l0=(s>>TWOPOTBITS_IN_LONG); if (t) l0++; l1 += l0; if (l1>l2) { l0 += l2-l1; l1=l2; } l4 += l0; p3 = mulrr(p3,p2); if (l4<=l2) { setlg(p2,l4); setlg(p4,l4); } subsrz(1,p3,p2); avma=av; } for ( ; i>=2; i--) { p3 = divrs(p4, 2*i*(2*i-1)); s -= expo(p3); t=s&(BITS_IN_LONG-1); l0=(s>>TWOPOTBITS_IN_LONG); if (t) l0++; l1 += l0; if (l1>l2) { l0 += l2-l1; l1=l2; } l4 += l0; p3 = mulrr(p3,p2); if (l4<=l2) { setlg(p2,l4); setlg(p4,l4); } subsrz(1,p3,p2); avma=av; } if (l4<=l2) { setlg(p2,l4); setlg(p4,l4); } setexpo(p4,expo(p4)-1); setsigne(p4, -signe(p4)); p2 = mulrr(p4,p2); for (i=1; i<=m; i++) { p2 = mulrr(p2,addsr(2,p2)); setexpo(p2,expo(p2)+1); } affrr(p2,y); avma=av; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/1558baf8c3b715dd704e6dddf2c7f1f51dc47e84/trans1.c/buggy/src/basemath/trans1.c |
affrr(p4,y); avma = av0; return y; | affr_fixlg(p4,y); avma = av0; return y; | mpatan(GEN x){ long l, l1, l2, n, m, i, lp, e, s, sx = signe(x); pari_sp av0, av; double alpha, beta, delta; GEN y, p1, p2, p3, p4, p5, unr; int inv; if (!sx) return realzero_bit(expo(x)); l = lp = lg(x); if (absrnz_egal1(x)) { /* |x| = 1 */ y = Pi2n(-2, l+1); if (sx < 0) setsigne(y,-1); return y; } e = expo(x); inv = (e >= 0); /* = (|x| > 1 ) */ if (e > 0) lp += (e>>TWOPOTBITS_IN_LONG); y = cgetr(lp); av0 = avma; p1 = cgetr(l+1); affrr(x,p1); setsigne(p1, 1); /* p1 = |x| */ if (inv) p1 = divsr(1, p1); e = expo(p1); if (e < -100) alpha = 1.65149612947 - e; /* log_2(Pi) - e */ else alpha = log2(PI / atan(rtodbl(p1))); beta = (double)(bit_accuracy(l)>>1); delta = 1 + beta - alpha/2; if (delta <= 0) { n = 1; m = 0; } else { double fi = alpha-2;#if 0 const double gama = 1.; /* optimize this */ if (delta >= gama*fi*fi) { n = (long)(1+sqrt(gama*delta)); m = (long)(1+sqrt(delta/gama) - fi); }#else if (delta >= fi*fi) { double t = 1 + sqrt(delta); n = (long)t; m = (long)(t - fi); }#endif else { n = (long)(1+beta/fi); m = 0; } } l2 = l+1+(m>>TWOPOTBITS_IN_LONG); p2 = cgetr(l2); affrr(p1,p2); av = avma; for (i=1; i<=m; i++) { p5 = addsr(1, mulrr(p2,p2)); setlg(p5,l2); p5 = addsr(1, sqrtr_abs(p5)); setlg(p5,l2); affrr(divrr(p2,p5), p2); avma = av; } p3 = mulrr(p2,p2); l1 = 4; unr = realun(l2); setlg(unr,4); p4 = cgetr(l2); setlg(p4,4); affrr(divrs(unr,2*n+1), p4); s = 0; e = expo(p3); av = avma; for (i = n; i > 1; i--) /* n >= 1. i = 1 done outside for efficiency */ { setlg(p3,l1); p5 = mulrr(p4,p3); s -= e; l1 += (s>>TWOPOTBITS_IN_LONG); s %= BITS_IN_LONG; if (l1 > l2) l1 = l2; setlg(unr,l1); p5 = subrr(divrs(unr,2*i-1), p5); setlg(p4,l1); affrr(p5,p4); avma = av; } setlg(p3, l2); p5 = mulrr(p4,p3); /* i = 1 */ setlg(unr,l2); p4 = subrr(unr, p5); p4 = mulrr(p2,p4); setexpo(p4, expo(p4)+m); if (inv) p4 = subrr(Pi2n(-1, lp), p4); if (sx < 0) setsigne(p4,-signe(p4)); affrr(p4,y); avma = av0; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
p1 = mplog( addrs(divsr(2,addsr(-1,x)),1) ); | p1 = logr_abs( addrs(divsr(2,addsr(-1,x)),1) ); | gath(GEN x, long prec){ pari_sp av; GEN a, y, p1; switch(typ(x)) { case t_REAL: if (!signe(x)) return realzero_bit(expo(x)); if (expo(x) < 0) return mpath(x); y = cgetg(3,t_COMPLEX); av = avma; p1 = mplog( addrs(divsr(2,addsr(-1,x)),1) ); setexpo(p1, expo(p1)-1); y[1]=(long)gerepileuptoleaf(av, p1); y[2]=(long)Pi2n(-1, lg(x)); return y; case t_COMPLEX: av = avma; p1 = glog( gaddgs(gdivsg(2,gsubsg(1,x)),-1), prec ); return gerepileupto(av, gmul2n(p1,-1)); case t_INTMOD: case t_PADIC: err(typeer,"gath"); default: av = avma; if (!(y = _toser(x))) break; if (valp(y) < 0) err(negexper,"gath"); p1 = gdiv(derivser(y), gsubsg(1,gsqr(y))); a = integ(p1, varn(y)); if (!valp(y)) a = gadd(a, gath((GEN)y[2],prec)); return gerepileupto(av, a); } return transc(gath,x,prec);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
if (ma > 962353) err(talker, "argument too large in ggamma"); | gammahs(long m, long prec){ GEN y = cgetr(prec), z; pari_sp av = avma; long ma = labs(m); if (ma > 962353) err(talker, "argument too large in ggamma"); if (ma > 200 + 50*(prec-2)) /* heuristic */ { z = stor(m + 1, prec); setexpo(z, expo(z)-1); affrr(cxgamma(z,0,prec), y); avma = av; return y; } z = sqrtr( mppi(prec) ); if (m) { GEN p1 = seq_umul(ma/2 + 1, ma); long v = vali(p1); p1 = shifti(p1, -v); v -= ma; if (m >= 0) z = mulri(z,p1); else { z = divri(z,p1); v = -v; if ((m&3) == 2) setsigne(z,-1); } setexpo(z, expo(z) + v); } affrr(z, y); avma = av; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
|
y = cgetr(prec); av = avma; p1 = mplog( itor(mpfact(itos(x) - 1), prec) ); affrr(p1, y); avma = av; return y; | av = avma; return gerepileuptoleaf(av, logr_abs( itor(mpfact(itos(x) - 1), prec) )); | glngamma(GEN x, long prec){ long i, n; pari_sp av; GEN a, y, p1; switch(typ(x)) { case t_INT: if (signe(x) <= 0) err(talker,"non-positive integer in glngamma"); if (cmpis(x,200 + 50*(prec-2)) > 0) /* heuristic */ return cxgamma(x, 1, prec); y = cgetr(prec); av = avma; p1 = mplog( itor(mpfact(itos(x) - 1), prec) ); affrr(p1, y); avma = av; return y; case t_REAL: case t_COMPLEX: return cxgamma(x, 1, prec); default: av = avma; if (!(y = _toser(x))) break; if (valp(y)) err(negexper,"glngamma"); p1 = gsubsg(1,y); if (!valp(p1)) err(impl,"lngamma around a!=1"); n = (lg(y)-3) / valp(p1); a = zeroser(varn(y), lg(y)-2); for (i=n; i>=2; i--) a = gmul(p1, gadd(a, gdivgs(szeta(i, prec),i))); a = gadd(a, mpeuler(prec)); return gerepileupto(av, gmul(a, p1)); case t_PADIC: err(impl,"p-adic lngamma function"); case t_INTMOD: err(typeer,"glngamma"); } return transc(glngamma,x,prec);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
return mpgamd(itos(x),prec); | { long k = itos(x); if (labs(k) > 962353) err(talker, "argument too large in ggamd"); return gammahs(k<<1, prec); } | ggamd(GEN x, long prec){ pari_sp av, tetpil; switch(typ(x)) { case t_INT: return mpgamd(itos(x),prec); case t_REAL: case t_FRAC: case t_COMPLEX: case t_QUAD: av=avma; x = gadd(x,ghalf); tetpil=avma; return gerepile(av,tetpil,ggamma(x,prec)); case t_INTMOD: case t_PADIC: err(typeer,"ggamd"); case t_SER: err(impl,"gamd of a power series"); } return transc(ggamd,x,prec);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
if (signe(sig) <= 0) { GEN pi = mppi(prec); z = gsub(cxpsi(gsub(gun,s), prec), gmul(pi, gcotan(gmul(pi,s), prec))); gaffect(z, res); avma = av; return res; } | if (signe(sig) <= 0) { funeq = 1; s = gsub(gun, s); sig = real_i(s); } if (typ(s0) == t_INT && signe(s0) <= 0) err(talker,"non-positive integer argument in cxpsi"); | cxpsi(GEN s0, long prec){ pari_sp av, av2; GEN sum,z,a,res,tes,in2,sig,s,unr; long lim,nn,k; const long la = 3; if (DEBUGLEVEL>2) (void)timer2(); s = trans_fix_arg(&prec,&s0,&sig,&av,&res); if (signe(sig) <= 0) { GEN pi = mppi(prec); z = gsub(cxpsi(gsub(gun,s), prec), gmul(pi, gcotan(gmul(pi,s), prec))); gaffect(z, res); avma = av; return res; } { double ssig = rtodbl(sig); double st = rtodbl(imag_i(s)); double l; { double rlog, ilog; /* log (s - Euler) */ dcxlog(ssig - 0.57721566, st, &rlog,&ilog); l = dnorm(rlog,ilog); } if (l < 0.000001) l = 0.000001; l = log(l) / 2.; lim = 2 + (long)ceil((bit_accuracy_mul(prec, LOG2) - l) / (2*(1+log((double)la)))); if (lim < 2) lim = 2; l = (2*lim-1)*la / (2.*PI); l = l*l - st*st; if (l < 0.) l = 0.; nn = (long)ceil( sqrt(l) - ssig ); if (nn < 1) nn = 1; if (DEBUGLEVEL>2) fprintferr("lim, nn: [%ld, %ld]\n",lim,nn); } prec++; unr = realun(prec); /* one extra word of precision */ a = gdiv(unr, gaddgs(s, nn)); /* 1 / (s+n) */ av2 = avma; sum = gmul2n(a,-1); for (k = 0; k < nn; k++) { sum = gadd(sum, gdiv(unr, gaddgs(s, k))); if ((k & 127) == 0) sum = gerepileupto(av2, sum); } z = gsub(glog(gaddgs(s, nn), prec), sum); if (DEBUGLEVEL>2) msgtimer("sum from 0 to N-1"); in2 = gsqr(a); av2 = avma; tes = divrs(bernreal(2*lim, prec), 2*lim); for (k=2*lim-2; k>=2; k-=2) { tes = gadd(gmul(in2,tes), divrs(bernreal(k, prec), k)); if ((k & 255) == 0) tes = gerepileupto(av2, tes); } if (DEBUGLEVEL>2) msgtimer("Bernoulli sum"); z = gsub(z, gmul(in2,tes)); gaffect(z, res); avma = av; return res;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
gaffect(z, res); avma = av; return res; | if (funeq) { GEN pi = mppi(prec); z = gadd(z, gmul(pi, gcotan(gmul(pi,s), prec))); } if (typ(z) == t_REAL) affr_fixlg(z, res); else { affr_fixlg((GEN)z[1], (GEN)res[1]); affr_fixlg((GEN)z[2], (GEN)res[2]); } avma = av; return res; | cxpsi(GEN s0, long prec){ pari_sp av, av2; GEN sum,z,a,res,tes,in2,sig,s,unr; long lim,nn,k; const long la = 3; if (DEBUGLEVEL>2) (void)timer2(); s = trans_fix_arg(&prec,&s0,&sig,&av,&res); if (signe(sig) <= 0) { GEN pi = mppi(prec); z = gsub(cxpsi(gsub(gun,s), prec), gmul(pi, gcotan(gmul(pi,s), prec))); gaffect(z, res); avma = av; return res; } { double ssig = rtodbl(sig); double st = rtodbl(imag_i(s)); double l; { double rlog, ilog; /* log (s - Euler) */ dcxlog(ssig - 0.57721566, st, &rlog,&ilog); l = dnorm(rlog,ilog); } if (l < 0.000001) l = 0.000001; l = log(l) / 2.; lim = 2 + (long)ceil((bit_accuracy_mul(prec, LOG2) - l) / (2*(1+log((double)la)))); if (lim < 2) lim = 2; l = (2*lim-1)*la / (2.*PI); l = l*l - st*st; if (l < 0.) l = 0.; nn = (long)ceil( sqrt(l) - ssig ); if (nn < 1) nn = 1; if (DEBUGLEVEL>2) fprintferr("lim, nn: [%ld, %ld]\n",lim,nn); } prec++; unr = realun(prec); /* one extra word of precision */ a = gdiv(unr, gaddgs(s, nn)); /* 1 / (s+n) */ av2 = avma; sum = gmul2n(a,-1); for (k = 0; k < nn; k++) { sum = gadd(sum, gdiv(unr, gaddgs(s, k))); if ((k & 127) == 0) sum = gerepileupto(av2, sum); } z = gsub(glog(gaddgs(s, nn), prec), sum); if (DEBUGLEVEL>2) msgtimer("sum from 0 to N-1"); in2 = gsqr(a); av2 = avma; tes = divrs(bernreal(2*lim, prec), 2*lim); for (k=2*lim-2; k>=2; k-=2) { tes = gadd(gmul(in2,tes), divrs(bernreal(k, prec), k)); if ((k & 255) == 0) tes = gerepileupto(av2, tes); } if (DEBUGLEVEL>2) msgtimer("Bernoulli sum"); z = gsub(z, gmul(in2,tes)); gaffect(z, res); avma = av; return res;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a0d8bd4ca3992fcf4e709bbc857cacac191dae1b/trans2.c/buggy/src/basemath/trans2.c |
mips_set_sr(sr & ~SR_IE); /* first disable ie bit (recommended) */ | mips_set_sr( (sr & ~SR_IE) ); /* first disable ie bit (recommended) */ | void _CPU_ISR_Set_level( unsigned32 new_level ){ unsigned int sr, srbits; /* ** mask off the int level bits only so we can ** preserve software int settings and FP enable ** for this thread. Note we don't force software ints ** enabled when changing level, they were turned on ** when this task was created, but may have been turned ** off since, so we'll just leave them alone. */ mips_get_sr(sr);#if __mips == 3 mips_set_sr(sr & ~SR_IE); /* first disable ie bit (recommended) */ srbits = sr & ~(0xfc00 | SR_EXL | SR_IE); sr = srbits | ((new_level==0)? (0xfc00 | SR_EXL | SR_IE): \ (((new_level<<9) & 0xfc000) | \ (new_level & 1)?(SR_EXL | SR_IE):0));/* if ( (new_level & SR_EXL) == (sr & SR_EXL) ) return; if ( (new_level & SR_EXL) == 0 ) { sr &= ~SR_EXL; * clear the EXL bit * mips_set_sr(sr); } else { sr |= SR_EXL|SR_IE; * enable exception level * mips_set_sr(sr); * first disable ie bit (recommended) * }*/ #elif __mips == 1 mips_set_sr( (sr & ~SR_IEC) ); srbits = sr & ~(0xfc00 | SR_IEC); sr = srbits | ((new_level==0)?0xfc01:( ((new_level<<9) & 0xfc000) | (new_level & 1)));#else#error "CPU ISR level: unknown MIPS level for SR handling"#endif mips_set_sr( sr );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/bd1ecb00d955204b7c01daffe7e6e7cb8c8a765a/cpu.c/clean/c/src/exec/score/cpu/mips/cpu.c |
(((new_level<<9) & 0xfc000) | \ | (((new_level<<9) & 0xfc00) | \ | void _CPU_ISR_Set_level( unsigned32 new_level ){ unsigned int sr, srbits; /* ** mask off the int level bits only so we can ** preserve software int settings and FP enable ** for this thread. Note we don't force software ints ** enabled when changing level, they were turned on ** when this task was created, but may have been turned ** off since, so we'll just leave them alone. */ mips_get_sr(sr);#if __mips == 3 mips_set_sr(sr & ~SR_IE); /* first disable ie bit (recommended) */ srbits = sr & ~(0xfc00 | SR_EXL | SR_IE); sr = srbits | ((new_level==0)? (0xfc00 | SR_EXL | SR_IE): \ (((new_level<<9) & 0xfc000) | \ (new_level & 1)?(SR_EXL | SR_IE):0));/* if ( (new_level & SR_EXL) == (sr & SR_EXL) ) return; if ( (new_level & SR_EXL) == 0 ) { sr &= ~SR_EXL; * clear the EXL bit * mips_set_sr(sr); } else { sr |= SR_EXL|SR_IE; * enable exception level * mips_set_sr(sr); * first disable ie bit (recommended) * }*/ #elif __mips == 1 mips_set_sr( (sr & ~SR_IEC) ); srbits = sr & ~(0xfc00 | SR_IEC); sr = srbits | ((new_level==0)?0xfc01:( ((new_level<<9) & 0xfc000) | (new_level & 1)));#else#error "CPU ISR level: unknown MIPS level for SR handling"#endif mips_set_sr( sr );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/bd1ecb00d955204b7c01daffe7e6e7cb8c8a765a/cpu.c/clean/c/src/exec/score/cpu/mips/cpu.c |
mips_set_sr( (sr & ~SR_IEC) ); | mips_set_sr( (sr & ~SR_IEC) ); | void _CPU_ISR_Set_level( unsigned32 new_level ){ unsigned int sr, srbits; /* ** mask off the int level bits only so we can ** preserve software int settings and FP enable ** for this thread. Note we don't force software ints ** enabled when changing level, they were turned on ** when this task was created, but may have been turned ** off since, so we'll just leave them alone. */ mips_get_sr(sr);#if __mips == 3 mips_set_sr(sr & ~SR_IE); /* first disable ie bit (recommended) */ srbits = sr & ~(0xfc00 | SR_EXL | SR_IE); sr = srbits | ((new_level==0)? (0xfc00 | SR_EXL | SR_IE): \ (((new_level<<9) & 0xfc000) | \ (new_level & 1)?(SR_EXL | SR_IE):0));/* if ( (new_level & SR_EXL) == (sr & SR_EXL) ) return; if ( (new_level & SR_EXL) == 0 ) { sr &= ~SR_EXL; * clear the EXL bit * mips_set_sr(sr); } else { sr |= SR_EXL|SR_IE; * enable exception level * mips_set_sr(sr); * first disable ie bit (recommended) * }*/ #elif __mips == 1 mips_set_sr( (sr & ~SR_IEC) ); srbits = sr & ~(0xfc00 | SR_IEC); sr = srbits | ((new_level==0)?0xfc01:( ((new_level<<9) & 0xfc000) | (new_level & 1)));#else#error "CPU ISR level: unknown MIPS level for SR handling"#endif mips_set_sr( sr );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/bd1ecb00d955204b7c01daffe7e6e7cb8c8a765a/cpu.c/clean/c/src/exec/score/cpu/mips/cpu.c |
sr = srbits | ((new_level==0)?0xfc01:( ((new_level<<9) & 0xfc000) | (new_level & 1))); | sr = srbits | ((new_level==0)?0xfc01:( ((new_level<<9) & 0xfc00) | \ (new_level & SR_IEC))); | void _CPU_ISR_Set_level( unsigned32 new_level ){ unsigned int sr, srbits; /* ** mask off the int level bits only so we can ** preserve software int settings and FP enable ** for this thread. Note we don't force software ints ** enabled when changing level, they were turned on ** when this task was created, but may have been turned ** off since, so we'll just leave them alone. */ mips_get_sr(sr);#if __mips == 3 mips_set_sr(sr & ~SR_IE); /* first disable ie bit (recommended) */ srbits = sr & ~(0xfc00 | SR_EXL | SR_IE); sr = srbits | ((new_level==0)? (0xfc00 | SR_EXL | SR_IE): \ (((new_level<<9) & 0xfc000) | \ (new_level & 1)?(SR_EXL | SR_IE):0));/* if ( (new_level & SR_EXL) == (sr & SR_EXL) ) return; if ( (new_level & SR_EXL) == 0 ) { sr &= ~SR_EXL; * clear the EXL bit * mips_set_sr(sr); } else { sr |= SR_EXL|SR_IE; * enable exception level * mips_set_sr(sr); * first disable ie bit (recommended) * }*/ #elif __mips == 1 mips_set_sr( (sr & ~SR_IEC) ); srbits = sr & ~(0xfc00 | SR_IEC); sr = srbits | ((new_level==0)?0xfc01:( ((new_level<<9) & 0xfc000) | (new_level & 1)));#else#error "CPU ISR level: unknown MIPS level for SR handling"#endif mips_set_sr( sr );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/bd1ecb00d955204b7c01daffe7e6e7cb8c8a765a/cpu.c/clean/c/src/exec/score/cpu/mips/cpu.c |
unsigned32 vector, | uint32_t vector, | void _CPU_ISR_install_raw_handler( unsigned32 vector, proc_ptr new_handler, proc_ptr *old_handler){ proc_ptr *interrupt_table = NULL;#if (M68K_HAS_FPSP_PACKAGE == 1) /* * If this vector being installed is one related to FP, then the * FPSP will install the handler itself and handle it completely * with no intervention from RTEMS. */ if (*_FPSP_install_raw_handler && (*_FPSP_install_raw_handler)(vector, new_handler, *old_handler)) return;#endif /* * On CPU models without a VBR, it is necessary for there to be some * header code for each ISR which saves a register, loads the vector * number, and jumps to _ISR_Handler. */ m68k_get_vbr( interrupt_table );#if ( M68K_HAS_VBR == 1 ) *old_handler = interrupt_table[ vector ]; interrupt_table[ vector ] = new_handler;#else /* * Install handler into RTEMS jump table and if VBR table is in * RAM, install the pointer to the appropriate jump table slot. * If the VBR table is in ROM, it is the BSP's responsibility to * load it appropriately to vector to the RTEMS jump table. */ *old_handler = (proc_ptr) _CPU_ISR_jump_table[vector].isr_handler; _CPU_ISR_jump_table[vector].isr_handler = (unsigned32) new_handler; if ( (unsigned32) interrupt_table != 0xFFFFFFFF ) interrupt_table[ vector ] = (proc_ptr) &_CPU_ISR_jump_table[vector];#endif /* M68K_HAS_VBR */} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/d86bae84e6165161c445ff5f5a07809d4a36b34e/cpu.c/buggy/cpukit/score/cpu/m68k/cpu.c |
_CPU_ISR_jump_table[vector].isr_handler = (unsigned32) new_handler; if ( (unsigned32) interrupt_table != 0xFFFFFFFF ) | _CPU_ISR_jump_table[vector].isr_handler = (uint32_t ) new_handler; if ( (uint32_t ) interrupt_table != 0xFFFFFFFF ) | void _CPU_ISR_install_raw_handler( unsigned32 vector, proc_ptr new_handler, proc_ptr *old_handler){ proc_ptr *interrupt_table = NULL;#if (M68K_HAS_FPSP_PACKAGE == 1) /* * If this vector being installed is one related to FP, then the * FPSP will install the handler itself and handle it completely * with no intervention from RTEMS. */ if (*_FPSP_install_raw_handler && (*_FPSP_install_raw_handler)(vector, new_handler, *old_handler)) return;#endif /* * On CPU models without a VBR, it is necessary for there to be some * header code for each ISR which saves a register, loads the vector * number, and jumps to _ISR_Handler. */ m68k_get_vbr( interrupt_table );#if ( M68K_HAS_VBR == 1 ) *old_handler = interrupt_table[ vector ]; interrupt_table[ vector ] = new_handler;#else /* * Install handler into RTEMS jump table and if VBR table is in * RAM, install the pointer to the appropriate jump table slot. * If the VBR table is in ROM, it is the BSP's responsibility to * load it appropriately to vector to the RTEMS jump table. */ *old_handler = (proc_ptr) _CPU_ISR_jump_table[vector].isr_handler; _CPU_ISR_jump_table[vector].isr_handler = (unsigned32) new_handler; if ( (unsigned32) interrupt_table != 0xFFFFFFFF ) interrupt_table[ vector ] = (proc_ptr) &_CPU_ISR_jump_table[vector];#endif /* M68K_HAS_VBR */} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/d86bae84e6165161c445ff5f5a07809d4a36b34e/cpu.c/buggy/cpukit/score/cpu/m68k/cpu.c |
Objects_Name name, | rtems_name name, | rtems_status_code rtems_message_queue_create( Objects_Name name, unsigned32 count, unsigned32 max_message_size, rtems_attribute attribute_set, Objects_Id *id){ register Message_queue_Control *the_message_queue; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( _Attributes_Is_global( attribute_set ) && !_Configuration_Is_multiprocessing() ) return( RTEMS_MP_NOT_CONFIGURED ); if (count == 0) return RTEMS_INVALID_NUMBER; if (max_message_size == 0) return RTEMS_INVALID_SIZE;#if 1 /* * I am not 100% sure this should be an error. * It seems reasonable to create a que with a large max size, * and then just send smaller msgs from remote (or all) nodes. */ if ( _Attributes_Is_global( attribute_set ) && _Configuration_MPCI_table && (_Configuration_MPCI_table->maximum_packet_size < max_message_size)) { return RTEMS_INVALID_SIZE; }#endif _Thread_Disable_dispatch(); /* protects object pointer */ the_message_queue = _Message_queue_Allocate(count, max_message_size); if ( !the_message_queue ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } if ( _Attributes_Is_global( attribute_set ) && !( _Objects_MP_Open( &_Message_queue_Information, name, the_message_queue->Object.id, FALSE ) ) ) { _Message_queue_Free( the_message_queue ); _Thread_Enable_dispatch(); return RTEMS_TOO_MANY; } the_message_queue->maximum_pending_messages = count; the_message_queue->attribute_set = attribute_set; the_message_queue->number_of_pending_messages = 0; _Chain_Initialize_empty( &the_message_queue->Pending_messages ); _Thread_queue_Initialize( &the_message_queue->Wait_queue, attribute_set, STATES_WAITING_FOR_MESSAGE ); _Objects_Open( &_Message_queue_Information, &the_message_queue->Object, name ); *id = the_message_queue->Object.id; if ( _Attributes_Is_global( attribute_set ) ) _Message_queue_MP_Send_process_packet( MESSAGE_QUEUE_MP_ANNOUNCE_CREATE, the_message_queue->Object.id, name, 0 ); _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/msg.c/buggy/cpukit/rtems/src/msg.c |
if ( !_Objects_Is_name_valid( name ) ) | if ( !rtems_is_name_valid( name ) ) | rtems_status_code rtems_message_queue_create( Objects_Name name, unsigned32 count, unsigned32 max_message_size, rtems_attribute attribute_set, Objects_Id *id){ register Message_queue_Control *the_message_queue; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( _Attributes_Is_global( attribute_set ) && !_Configuration_Is_multiprocessing() ) return( RTEMS_MP_NOT_CONFIGURED ); if (count == 0) return RTEMS_INVALID_NUMBER; if (max_message_size == 0) return RTEMS_INVALID_SIZE;#if 1 /* * I am not 100% sure this should be an error. * It seems reasonable to create a que with a large max size, * and then just send smaller msgs from remote (or all) nodes. */ if ( _Attributes_Is_global( attribute_set ) && _Configuration_MPCI_table && (_Configuration_MPCI_table->maximum_packet_size < max_message_size)) { return RTEMS_INVALID_SIZE; }#endif _Thread_Disable_dispatch(); /* protects object pointer */ the_message_queue = _Message_queue_Allocate(count, max_message_size); if ( !the_message_queue ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } if ( _Attributes_Is_global( attribute_set ) && !( _Objects_MP_Open( &_Message_queue_Information, name, the_message_queue->Object.id, FALSE ) ) ) { _Message_queue_Free( the_message_queue ); _Thread_Enable_dispatch(); return RTEMS_TOO_MANY; } the_message_queue->maximum_pending_messages = count; the_message_queue->attribute_set = attribute_set; the_message_queue->number_of_pending_messages = 0; _Chain_Initialize_empty( &the_message_queue->Pending_messages ); _Thread_queue_Initialize( &the_message_queue->Wait_queue, attribute_set, STATES_WAITING_FOR_MESSAGE ); _Objects_Open( &_Message_queue_Information, &the_message_queue->Object, name ); *id = the_message_queue->Object.id; if ( _Attributes_Is_global( attribute_set ) ) _Message_queue_MP_Send_process_packet( MESSAGE_QUEUE_MP_ANNOUNCE_CREATE, the_message_queue->Object.id, name, 0 ); _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/msg.c/buggy/cpukit/rtems/src/msg.c |
_Objects_Open( &_Message_queue_Information, &the_message_queue->Object, name ); | _Objects_Open( &_Message_queue_Information, &the_message_queue->Object, &name ); | rtems_status_code rtems_message_queue_create( Objects_Name name, unsigned32 count, unsigned32 max_message_size, rtems_attribute attribute_set, Objects_Id *id){ register Message_queue_Control *the_message_queue; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( _Attributes_Is_global( attribute_set ) && !_Configuration_Is_multiprocessing() ) return( RTEMS_MP_NOT_CONFIGURED ); if (count == 0) return RTEMS_INVALID_NUMBER; if (max_message_size == 0) return RTEMS_INVALID_SIZE;#if 1 /* * I am not 100% sure this should be an error. * It seems reasonable to create a que with a large max size, * and then just send smaller msgs from remote (or all) nodes. */ if ( _Attributes_Is_global( attribute_set ) && _Configuration_MPCI_table && (_Configuration_MPCI_table->maximum_packet_size < max_message_size)) { return RTEMS_INVALID_SIZE; }#endif _Thread_Disable_dispatch(); /* protects object pointer */ the_message_queue = _Message_queue_Allocate(count, max_message_size); if ( !the_message_queue ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } if ( _Attributes_Is_global( attribute_set ) && !( _Objects_MP_Open( &_Message_queue_Information, name, the_message_queue->Object.id, FALSE ) ) ) { _Message_queue_Free( the_message_queue ); _Thread_Enable_dispatch(); return RTEMS_TOO_MANY; } the_message_queue->maximum_pending_messages = count; the_message_queue->attribute_set = attribute_set; the_message_queue->number_of_pending_messages = 0; _Chain_Initialize_empty( &the_message_queue->Pending_messages ); _Thread_queue_Initialize( &the_message_queue->Wait_queue, attribute_set, STATES_WAITING_FOR_MESSAGE ); _Objects_Open( &_Message_queue_Information, &the_message_queue->Object, name ); *id = the_message_queue->Object.id; if ( _Attributes_Is_global( attribute_set ) ) _Message_queue_MP_Send_process_packet( MESSAGE_QUEUE_MP_ANNOUNCE_CREATE, the_message_queue->Object.id, name, 0 ); _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/msg.c/buggy/cpukit/rtems/src/msg.c |
Objects_Name name, | rtems_name name, | rtems_status_code rtems_message_queue_ident( Objects_Name name, unsigned32 node, Objects_Id *id){ return( _Objects_Name_to_id( &_Message_queue_Information, name, node, id ) );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/msg.c/buggy/cpukit/rtems/src/msg.c |
return( _Objects_Name_to_id( &_Message_queue_Information, name, node, id ) ); | return _Objects_Name_to_id( &_Message_queue_Information, &name, node, id ); | rtems_status_code rtems_message_queue_ident( Objects_Name name, unsigned32 node, Objects_Id *id){ return( _Objects_Name_to_id( &_Message_queue_Information, name, node, id ) );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/msg.c/buggy/cpukit/rtems/src/msg.c |
fs_info->ino_count = 1; fs_info->memfile_handlers = memfile_handlers; fs_info->memfile_handlers = directory_handlers; | fs_info->ino_count = 1; fs_info->memfile_handlers = memfile_handlers; fs_info->directory_handlers = directory_handlers; | int IMFS_initialize_support( rtems_filesystem_mount_table_entry_t *temp_mt_entry, rtems_filesystem_operations_table *op_table, rtems_filesystem_file_handlers_r *memfile_handlers, rtems_filesystem_file_handlers_r *directory_handlers){ IMFS_fs_info_t *fs_info; IMFS_jnode_t *jnode; /* * Create the root node */ temp_mt_entry->mt_fs_root.node_access = IMFS_create_node( NULL, IMFS_DIRECTORY, "", ( S_IRWXO | S_IRWXG| S_IRWXU ), NULL ); temp_mt_entry->mt_fs_root.handlers = directory_handlers; temp_mt_entry->mt_fs_root.ops = op_table; temp_mt_entry->pathconf_limits_and_options = IMFS_LIMITS_AND_OPTIONS; /* * Create custom file system data. */ fs_info = calloc( 1, sizeof( IMFS_fs_info_t ) ); if ( !fs_info ){ free(temp_mt_entry->mt_fs_root.node_access); return 1; } temp_mt_entry->fs_info = fs_info; /* * Set st_ino for the root to 1. */ fs_info->ino_count = 1; fs_info->memfile_handlers = memfile_handlers; fs_info->memfile_handlers = directory_handlers; jnode = temp_mt_entry->mt_fs_root.node_access; jnode->st_ino = fs_info->ino_count; return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3fb2a8daf7ef4388c262385c445cbb533401f28b/imfs_initsupp.c/buggy/cpukit/libfs/src/imfs/imfs_initsupp.c |
unsigned32 baudrate /* baud rate to use */ | uint32_t baudrate /* baud rate to use */ | int termios_printk_open/*-------------------------------------------------------------------------*\| Purpose: || try to open given serial debug port |+---------------------------------------------------------------------------+| Input Parameters: |\*-------------------------------------------------------------------------*/( const char *dev_name, /* name of device to open */ unsigned32 baudrate /* baud rate to use */)/*-------------------------------------------------------------------------*\| Return Value: || 0 on success, -1 and errno otherwise |\*=========================================================================*/{ boolean err_occurred = FALSE; rtems_libio_t *iop = NULL; struct termios act_termios; tcflag_t baudcode = B0; if (termios_printk_fd >= 0) { /* * already initialized */ return 0; } /* * translate baudrate into baud code */ switch(baudrate) { case 50: baudcode = B50; break; case 75: baudcode = B75; break; case 110: baudcode = B110; break; case 134: baudcode = B134; break; case 150: baudcode = B150; break; case 200: baudcode = B200; break; case 300: baudcode = B300; break; case 600: baudcode = B600; break; case 1200: baudcode = B1200; break; case 1800: baudcode = B1800; break; case 2400: baudcode = B2400; break; case 4800: baudcode = B4800; break; case 9600: baudcode = B9600; break; case 19200: baudcode = B19200; break; case 38400: baudcode = B38400; break; case 57600: baudcode = B57600; break; case 115200: baudcode = B115200; break; case 230400: baudcode = B230400; break; case 460800: baudcode = B460800; break; default : err_occurred = TRUE; errno = EINVAL; break; } /* * open device for serdbg operation */ if (!err_occurred && (dev_name != NULL) && (dev_name[0] != '\0')) { termios_printk_fd = open(dev_name,O_RDWR); if (termios_printk_fd < 0) { err_occurred = TRUE; } } /* * capture tty structure */ if (!err_occurred) { iop = &rtems_libio_iops[termios_printk_fd]; termios_printk_tty = iop->data1; } /* * set device baudrate * (and transp mode, this is not really needed) * ... */ /* * ... get fd settings */ if (!err_occurred && (0 != tcgetattr(termios_printk_fd,&act_termios))) { err_occurred = TRUE; } if (!err_occurred) { cfsetospeed(&act_termios,baudcode); cfsetispeed(&act_termios,baudcode); if (0 != tcsetattr(termios_printk_fd,TCSANOW,&act_termios)) { err_occurred = TRUE; } } if (!err_occurred) { BSP_output_char = termios_printk_outputchar; BSP_poll_char = termios_printk_inputchar; } return (err_occurred ? -1 : 0);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/termios_printk.c/buggy/cpukit/libmisc/serdbg/termios_printk.c |
so_ioctl (struct socket *so, unsigned32 command, void *buffer) | so_ioctl (rtems_libio_t *iop, struct socket *so, unsigned32 command, void *buffer) | so_ioctl (struct socket *so, unsigned32 command, void *buffer){ switch (command) { case FIONBIO: if (*(int *)buffer) so->so_state |= SS_NBIO; else so->so_state &= ~SS_NBIO; return 0; case FIONREAD: *(int *)buffer = so->so_rcv.sb_cc; return 0; } if (IOCGROUP(command) == 'i') return ifioctl (so, command, buffer, NULL); if (IOCGROUP(command) == 'r') return rtioctl (command, buffer, NULL); return (*so->so_proto->pr_usrreqs->pru_control)(so, command, buffer, 0);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/rtems_syscall.c/clean/c/src/libnetworking/rtems/rtems_syscall.c |
if (*(int *)buffer) | if (*(int *)buffer) { iop->flags |= O_NONBLOCK; | so_ioctl (struct socket *so, unsigned32 command, void *buffer){ switch (command) { case FIONBIO: if (*(int *)buffer) so->so_state |= SS_NBIO; else so->so_state &= ~SS_NBIO; return 0; case FIONREAD: *(int *)buffer = so->so_rcv.sb_cc; return 0; } if (IOCGROUP(command) == 'i') return ifioctl (so, command, buffer, NULL); if (IOCGROUP(command) == 'r') return rtioctl (command, buffer, NULL); return (*so->so_proto->pr_usrreqs->pru_control)(so, command, buffer, 0);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/rtems_syscall.c/clean/c/src/libnetworking/rtems/rtems_syscall.c |
else | } else { iop->flags &= ~O_NONBLOCK; | so_ioctl (struct socket *so, unsigned32 command, void *buffer){ switch (command) { case FIONBIO: if (*(int *)buffer) so->so_state |= SS_NBIO; else so->so_state &= ~SS_NBIO; return 0; case FIONREAD: *(int *)buffer = so->so_rcv.sb_cc; return 0; } if (IOCGROUP(command) == 'i') return ifioctl (so, command, buffer, NULL); if (IOCGROUP(command) == 'r') return rtioctl (command, buffer, NULL); return (*so->so_proto->pr_usrreqs->pru_control)(so, command, buffer, 0);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/rtems_syscall.c/clean/c/src/libnetworking/rtems/rtems_syscall.c |
} | so_ioctl (struct socket *so, unsigned32 command, void *buffer){ switch (command) { case FIONBIO: if (*(int *)buffer) so->so_state |= SS_NBIO; else so->so_state &= ~SS_NBIO; return 0; case FIONREAD: *(int *)buffer = so->so_rcv.sb_cc; return 0; } if (IOCGROUP(command) == 'i') return ifioctl (so, command, buffer, NULL); if (IOCGROUP(command) == 'r') return rtioctl (command, buffer, NULL); return (*so->so_proto->pr_usrreqs->pru_control)(so, command, buffer, 0);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/rtems_syscall.c/clean/c/src/libnetworking/rtems/rtems_syscall.c |
|
short val; | unsigned long val; | sosetopt(so, level, optname, m0) register struct socket *so; int level, optname; struct mbuf *m0;{ int error = 0; register struct mbuf *m = m0; if (level != SOL_SOCKET) { if (so->so_proto && so->so_proto->pr_ctloutput) return ((*so->so_proto->pr_ctloutput) (PRCO_SETOPT, so, level, optname, &m0)); error = ENOPROTOOPT; } else { switch (optname) { case SO_LINGER: if (m == NULL || m->m_len != sizeof (struct linger)) { error = EINVAL; goto bad; } so->so_linger = mtod(m, struct linger *)->l_linger; /* fall thru... */ case SO_DEBUG: case SO_KEEPALIVE: case SO_DONTROUTE: case SO_USELOOPBACK: case SO_BROADCAST: case SO_REUSEADDR: case SO_REUSEPORT: case SO_OOBINLINE: case SO_TIMESTAMP: if (m == NULL || m->m_len < sizeof (int)) { error = EINVAL; goto bad; } if (*mtod(m, int *)) so->so_options |= optname; else so->so_options &= ~optname; break; case SO_SNDBUF: case SO_RCVBUF: case SO_SNDLOWAT: case SO_RCVLOWAT: { int optval; if (m == NULL || m->m_len < sizeof (int)) { error = EINVAL; goto bad; } /* * Values < 1 make no sense for any of these * options, so disallow them. */ optval = *mtod(m, int *); if (optval < 1) { error = EINVAL; goto bad; } switch (optname) { case SO_SNDBUF: case SO_RCVBUF: if (sbreserve(optname == SO_SNDBUF ? &so->so_snd : &so->so_rcv, (u_long) optval) == 0) { error = ENOBUFS; goto bad; } break; /* * Make sure the low-water is never greater than * the high-water. */ case SO_SNDLOWAT: so->so_snd.sb_lowat = (optval > so->so_snd.sb_hiwat) ? so->so_snd.sb_hiwat : optval; break; case SO_RCVLOWAT: so->so_rcv.sb_lowat = (optval > so->so_rcv.sb_hiwat) ? so->so_rcv.sb_hiwat : optval; break; } break; } case SO_SNDTIMEO: case SO_RCVTIMEO: { struct timeval *tv; short val; if (m == NULL || m->m_len < sizeof (*tv)) { error = EINVAL; goto bad; } tv = mtod(m, struct timeval *); if (tv->tv_sec > SHRT_MAX / hz - hz) { error = EDOM; goto bad; } val = tv->tv_sec * hz + tv->tv_usec / tick; switch (optname) { case SO_SNDTIMEO: so->so_snd.sb_timeo = val; break; case SO_RCVTIMEO: so->so_rcv.sb_timeo = val; break; } break; } case SO_PRIVSTATE: /* we don't care what the parameter is... */ so->so_state &= ~SS_PRIV; break; default: error = ENOPROTOOPT; break; } if (error == 0 && so->so_proto && so->so_proto->pr_ctloutput) { (void) ((*so->so_proto->pr_ctloutput) (PRCO_SETOPT, so, level, optname, &m0)); m = NULL; /* freed by protocol */ } }bad: if (m) (void) m_free(m); return (error);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/847375f3ad4af55b9bd4d8a6daff313165de5fd8/uipc_socket.c/buggy/c/src/libnetworking/kern/uipc_socket.c |
if (tv->tv_sec > SHRT_MAX / hz - hz) { | if (tv->tv_sec >= (ULONG_MAX - hz) / hz) { | sosetopt(so, level, optname, m0) register struct socket *so; int level, optname; struct mbuf *m0;{ int error = 0; register struct mbuf *m = m0; if (level != SOL_SOCKET) { if (so->so_proto && so->so_proto->pr_ctloutput) return ((*so->so_proto->pr_ctloutput) (PRCO_SETOPT, so, level, optname, &m0)); error = ENOPROTOOPT; } else { switch (optname) { case SO_LINGER: if (m == NULL || m->m_len != sizeof (struct linger)) { error = EINVAL; goto bad; } so->so_linger = mtod(m, struct linger *)->l_linger; /* fall thru... */ case SO_DEBUG: case SO_KEEPALIVE: case SO_DONTROUTE: case SO_USELOOPBACK: case SO_BROADCAST: case SO_REUSEADDR: case SO_REUSEPORT: case SO_OOBINLINE: case SO_TIMESTAMP: if (m == NULL || m->m_len < sizeof (int)) { error = EINVAL; goto bad; } if (*mtod(m, int *)) so->so_options |= optname; else so->so_options &= ~optname; break; case SO_SNDBUF: case SO_RCVBUF: case SO_SNDLOWAT: case SO_RCVLOWAT: { int optval; if (m == NULL || m->m_len < sizeof (int)) { error = EINVAL; goto bad; } /* * Values < 1 make no sense for any of these * options, so disallow them. */ optval = *mtod(m, int *); if (optval < 1) { error = EINVAL; goto bad; } switch (optname) { case SO_SNDBUF: case SO_RCVBUF: if (sbreserve(optname == SO_SNDBUF ? &so->so_snd : &so->so_rcv, (u_long) optval) == 0) { error = ENOBUFS; goto bad; } break; /* * Make sure the low-water is never greater than * the high-water. */ case SO_SNDLOWAT: so->so_snd.sb_lowat = (optval > so->so_snd.sb_hiwat) ? so->so_snd.sb_hiwat : optval; break; case SO_RCVLOWAT: so->so_rcv.sb_lowat = (optval > so->so_rcv.sb_hiwat) ? so->so_rcv.sb_hiwat : optval; break; } break; } case SO_SNDTIMEO: case SO_RCVTIMEO: { struct timeval *tv; short val; if (m == NULL || m->m_len < sizeof (*tv)) { error = EINVAL; goto bad; } tv = mtod(m, struct timeval *); if (tv->tv_sec > SHRT_MAX / hz - hz) { error = EDOM; goto bad; } val = tv->tv_sec * hz + tv->tv_usec / tick; switch (optname) { case SO_SNDTIMEO: so->so_snd.sb_timeo = val; break; case SO_RCVTIMEO: so->so_rcv.sb_timeo = val; break; } break; } case SO_PRIVSTATE: /* we don't care what the parameter is... */ so->so_state &= ~SS_PRIV; break; default: error = ENOPROTOOPT; break; } if (error == 0 && so->so_proto && so->so_proto->pr_ctloutput) { (void) ((*so->so_proto->pr_ctloutput) (PRCO_SETOPT, so, level, optname, &m0)); m = NULL; /* freed by protocol */ } }bad: if (m) (void) m_free(m); return (error);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/847375f3ad4af55b9bd4d8a6daff313165de5fd8/uipc_socket.c/buggy/c/src/libnetworking/kern/uipc_socket.c |
int val = (optname == SO_SNDTIMEO ? | unsigned long val = (optname == SO_SNDTIMEO ? | sogetopt(so, level, optname, mp) register struct socket *so; int level, optname; struct mbuf **mp;{ register struct mbuf *m; if (level != SOL_SOCKET) { if (so->so_proto && so->so_proto->pr_ctloutput) { return ((*so->so_proto->pr_ctloutput) (PRCO_GETOPT, so, level, optname, mp)); } else return (ENOPROTOOPT); } else { m = m_get(M_WAIT, MT_SOOPTS); m->m_len = sizeof (int); switch (optname) { case SO_LINGER: m->m_len = sizeof (struct linger); mtod(m, struct linger *)->l_onoff = so->so_options & SO_LINGER; mtod(m, struct linger *)->l_linger = so->so_linger; break; case SO_USELOOPBACK: case SO_DONTROUTE: case SO_DEBUG: case SO_KEEPALIVE: case SO_REUSEADDR: case SO_REUSEPORT: case SO_BROADCAST: case SO_OOBINLINE: case SO_TIMESTAMP: *mtod(m, int *) = so->so_options & optname; break; case SO_PRIVSTATE: *mtod(m, int *) = so->so_state & SS_PRIV; break; case SO_TYPE: *mtod(m, int *) = so->so_type; break; case SO_ERROR: *mtod(m, int *) = so->so_error; so->so_error = 0; break; case SO_SNDBUF: *mtod(m, int *) = so->so_snd.sb_hiwat; break; case SO_RCVBUF: *mtod(m, int *) = so->so_rcv.sb_hiwat; break; case SO_SNDLOWAT: *mtod(m, int *) = so->so_snd.sb_lowat; break; case SO_RCVLOWAT: *mtod(m, int *) = so->so_rcv.sb_lowat; break; case SO_SNDTIMEO: case SO_RCVTIMEO: { int val = (optname == SO_SNDTIMEO ? so->so_snd.sb_timeo : so->so_rcv.sb_timeo); m->m_len = sizeof(struct timeval); mtod(m, struct timeval *)->tv_sec = val / hz; mtod(m, struct timeval *)->tv_usec = (val % hz) * tick; break; } default: (void)m_free(m); return (ENOPROTOOPT); } *mp = m; return (0); }} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/847375f3ad4af55b9bd4d8a6daff313165de5fd8/uipc_socket.c/buggy/c/src/libnetworking/kern/uipc_socket.c |
M = matrixbase2(L, T, disc); | for(i=1; i<=n; i++) { z = (GEN)L[i]; if (signe(z[2])) break; L[i] = z[1]; } M = matrixbase2(L, gmul(T, dbltor(1.)), disc); | initborne(GEN T, GEN disc, struct galois_borne * gb, long ppp){ ulong ltop = avma, lbot, av2; GEN borne, borneroots, borneabs; int i, j; int n; GEN L, M, z; L = roots(T, DEFAULTPREC); n = lg(L) - 1; M = matrixbase2(L, T, disc); borne = gzero; for (i = 1; i <= n; i++) { z = gzero; for (j = 1; j <= n; j++) z = gadd(z, gabs(((GEN **) M)[j][i], DEFAULTPREC)); if (gcmp(z, borne) > 0) borne = z; } borneroots = gzero; for (i = 1; i <= n; i++) { z = gabs((GEN) L[i], DEFAULTPREC); if (gcmp(z, borneroots) > 0) borneroots = z; } borneabs = addsr(1, gpowgs(addsr(n, borneroots), n / ppp)); lbot = avma; borneroots = addsr(1, gmul(borne, borneroots)); av2 = avma; borneabs = gmul2n(gmul(borne, borneabs), 4); gb->valsol = itos(gceil(gdiv(glog(gmul2n(borneroots, 4 + (n >> 1)), DEFAULTPREC), glog(gb->l, DEFAULTPREC)))); if (DEBUGLEVEL >= 4) fprintferr("GaloisConj:val1=%d\n", gb->valsol); gb->valabs = max(gb->valsol, itos(gceil(gdiv(glog(borneabs, DEFAULTPREC), glog(gb->l, DEFAULTPREC))))); if (DEBUGLEVEL >= 4) fprintferr("GaloisConj:val2=%d\n", gb->valabs); avma = av2; gb->bornesol = gerepile(ltop, lbot, borneroots); gb->ladicsol = gpowgs(gb->l, gb->valsol); gb->ladicabs = gpowgs(gb->l, gb->valabs);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/f55e360df08ebbc9b4d9b945e47ba627876265ee/galconj.c/buggy/src/basemath/galconj.c |
long nb,v, lim1; | long p,nb,v, lim1; | omega(GEN n){ byteptr d=diffptr+1; gpmem_t av = avma; long nb,v, lim1; if (typ(n) != t_INT) err(arither1); if (!signe(n)) err(arither2); if (is_pm1(n)) return 0; v=vali(n); nb = v ? 1 : 0; n = absi(shifti(n,-v)); p = 2; if (is_pm1(n)) return nb; lim1 = tridiv_bound(n,1); while (*d && p < lim1) { p += *d++; if (mpdivisis(n,p,n)) { nb++; while (mpdivisis(n,p,n)); /* empty */ if (is_pm1(n)) { avma = av; return nb; } } } if (cmpii(sqru(p),n) >= 0 || pseudoprime(n)) { avma = av; return nb+1; } /* large composite without small factors */ nb += ifac_omega(n, decomp_default_hint); avma=av; return nb;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/380d364b3e2124821c237296d1775f6df176a67e/arith2.c/clean/src/basemath/arith2.c |
a = 1 + (nbcmax<<7); /* seed for choice of curves */ | a = 1 + (nbcmax<<7)*(size&0xffff); /* seed for choice of curves */ | ellfacteur(GEN n, int insist){ static ulong TB1[] = { /* table revised, cf. below 1998Aug15 --GN */ 142,172,208,252,305,370,450,545,661,801,972,1180,1430, 1735,2100,2550,3090,3745,4540,5505,6675,8090,9810,11900, 14420,17490,21200,25700,31160,37780UL,45810UL,55550UL,67350UL, 81660UL,99010UL,120050UL,145550UL,176475UL,213970UL,259430UL, 314550UL,381380UL,462415UL,560660UL,679780UL,824220UL,999340UL, 1211670UL,1469110UL,1781250UL,2159700UL,2618600UL,3175000UL, 3849600UL,4667500UL,5659200UL,6861600UL,8319500UL,10087100UL, 12230300UL,14828900UL,17979600UL,21799700UL,26431500UL, 32047300UL,38856400UL, /* 110 times that still fits into 32bits */#ifdef LONG_IS_64BIT 47112200UL,57122100UL,69258800UL,83974200UL,101816200UL, 123449000UL,149678200UL,181480300UL,220039400UL,266791100UL, 323476100UL,392204900UL,475536500UL,576573500UL,699077800UL, 847610500UL,1027701900UL,1246057200UL,1510806400UL,1831806700UL, 2221009800UL,2692906700UL,3265067200UL,3958794400UL,4799917500UL, /* the only reason to stop here is that I got bored (and that users will * get bored watching their 64bit machines churning on such large numbers * for month after month). Someone can extend this table when the hardware * has gotten 100 times faster than now --GN */#endif }; static ulong TB1_for_stage[] = { /* table revised 1998Aug11 --GN. * Start a little below the optimal B1 for finding factors which would just * have been missed by pollardbrent(), and escalate gradually, changing * curves sufficiently frequently to give good coverage of the small factor * ranges. Entries grow a bit faster than what Paul says would be optimal * but a table instead of a 2D array keeps the code simple */ 500,520,560,620,700,800,900,1000,1150,1300,1450,1600,1800,2000, 2200,2450,2700,2950,3250,3600,4000,4400,4850,5300,5800,6400, 7100,7850,8700,9600,10600,11700,12900,14200,15700,17300, 19000,21000,23200,25500,28000,31000,34500UL,38500UL,43000UL, 48000UL,53800UL,60400UL,67750UL,76000UL,85300UL,95700UL, 107400UL,120500UL,135400UL,152000UL,170800UL,191800UL,215400UL, 241800UL,271400UL,304500UL,341500UL,383100UL,429700UL,481900UL, 540400UL,606000UL,679500UL,761800UL,854100UL,957500UL,1073500UL, }; long nbc,nbc2,dsn,dsnmax,rep,spc,gse,gss,rcn,rcn0,bstp,bstp0; long a, i, j, k, size = expi(n) + 1, tf = lgefint(n); ulong B1,B2,B2_p,B2_rt,m,p,p0,dp; GEN *X,*XAUX,*XT,*XD,*XG,*YG,*XH,*XB,*XB2,*Xh,*Yh,*Xb; GEN res = cgeti(tf); pari_sp av1, avtmp, av = avma; int rflag, use_clones = 0; byteptr d, d0; N = n; /* make n known to auxiliary functions */ /* determine where we'll start, how long we'll persist, and how many * curves we'll use in parallel */ if (insist) { dsnmax = (size >> 2) - 10; if (dsnmax < 0) dsnmax = 0;#ifdef LONG_IS_64BIT else if (dsnmax > 90) dsnmax = 90;#else else if (dsnmax > 65) dsnmax = 65;#endif dsn = (size >> 3) - 5; if (dsn < 0) dsn = 0; else if (dsn > 47) dsn = 47; /* pick up the torch where non-insistent stage would have given up */ nbc = dsn + (dsn >> 2) + 9; /* 8 or more curves in parallel */ nbc &= ~3; /* nbc is always a multiple of 4 */ if (nbc > nbcmax) nbc = nbcmax; a = 1 + (nbcmax<<7); /* seed for choice of curves */ rep = 0; /* gcc -Wall */ } else { dsn = (size - 140) >> 3; if (dsn > 12) dsn = 12; dsnmax = 72; if (dsn < 0) /* < 140 bits: decline the task */ {#ifdef __EMX__ /* MPQS's disk access under DOS/EMX would be abysmally slow, so... */ dsn = 0; rep = 20; nbc = 8;#else if (DEBUGLEVEL >= 4) fprintferr("ECM: number too small to justify this stage\n"); avma = av; return NULL;#endif } else { rep = (size <= 248 ? (size <= 176 ? (size - 124) >> 4 : (size - 148) >> 3) : (size - 224) >> 1); nbc = ((size >> 3) << 2) - 80; if (nbc < 8) nbc = 8; else if (nbc > nbcmax) nbc = nbcmax;#ifdef __EMX__ rep += 20;#endif } /* it may be convenient to use disjoint sets of curves for the non-insist * and insist phases; moreover, repeated non-insistent calls acting on * factors of the same original number should try to use fresh curves. * The following achieves this */ a = 1 + (nbcmax<<3)*(size & 0xf); } if (dsn > dsnmax) dsn = dsnmax; if (DEBUGLEVEL >= 4) { (void)timer2(); fprintferr("ECM: working on %ld curves at a time; initializing", nbc); if (!insist) { if (rep == 1) fprintferr(" for one round"); else fprintferr(" for up to %ld rounds", rep); } fprintferr("...\n"); } /* The auxiliary routines above need < (3*nbc+240)*tf words on the PARI * stack, in addition to the spc*(tf+1) words occupied by our main table. * If stack space is already tight, try the heap, using newbloc(). */ nbc2 = nbc << 1; spc = (13 + 48) * nbc2 + bstpmax * 4;{ const long tw = evallg(tf) | evaltyp(t_INT); GEN w; if ((long)((GEN)avma - (GEN)bot) < spc + 385 + (spc + 3*nbc + 240)*tf) { if (DEBUGLEVEL >= 5) fprintferr("ECM: stack tight, using heap space\n"); use_clones = 1; X = (GEN*)newbloc(spc + 385); w = newbloc(spc*tf); } else { X = (GEN*)new_chunk(spc + 385); w = new_chunk(spc*tf); } /* hack for X[i] = cgeti(tf). X = current point in B1 phase */ for (i = spc; i--; ) { X[i] = w; *w = tw; w += tf; }} XAUX = X + nbc2; /* scratchpad for ellmult() */ XT = XAUX + nbc2; /* ditto, will later hold [3*210]Q */ XD = XT + nbc2; /* room for various multiples */ XB = XD + 10*nbc2; /* start of baby steps table */ XB2 = XB + 2 * bstpmax; /* middle of baby steps table */ XH = XB2 + 2 * bstpmax; /* end of bstps table, start of helix */ Xh = XH + 48*nbc2; /* little helix, X coords */ Yh = XH + 192; /* ditto, Y coords */ /* XG will be set inside the main loop, since it depends on B2 */ /* Xh range of 384 pointers not set; these will later duplicate the pointers * in the XH range, 4 curves at a time. Some of the cells reserved here for * the XB range will never be used, instead, we'll warp the pointers to * connect to (read-only) GENs in the X/XD range; it would be complicated to * skip them here to conserve merely a few KBy of stack or heap space. */ /* ECM MAIN LOOP */ for(;;) { d = diffptr; rcn = NPRC; /* multipliers begin at the beginning */ /* pick curves */ for (i = nbc2; i--; ) affsi(a++, X[i]); /* pick bounds */ B1 = insist ? TB1[dsn] : TB1_for_stage[dsn]; B2 = 110*B1; B2_rt = (ulong)(sqrt((double)B2)); /* pick giant step exponent and size. * With 32 baby steps, a giant step corresponds to 32*420 = 13440, appro- * priate for the smallest B2s. With 1024, a giant step will be 430080; * this will be appropriate for B1 >~ 42000, where 512 baby steps would * imply roughly the same number of E.C. additions. */ gse = B1 < 656 ? (B1 < 200? 5: 6) : (B1 < 10500 ? (B1 < 2625? 7: 8) : (B1 < 42000? 9: 10)); gss = 1UL << gse; XG = XT + gse*nbc2; /* will later hold [2^(gse+1)*210]Q */ YG = XG + nbc; if (DEBUGLEVEL >= 4) { fprintferr("ECM: time = %6ld ms\nECM: dsn = %2ld,\tB1 = %4lu,", timer2(), dsn, B1); fprintferr("\tB2 = %6lu,\tgss = %4ld*420\n", B2, gss); } p = 0; NEXT_PRIME_VIADIFF(p,d); /* ---B1 PHASE--- */ /* treat p=2 separately */ B2_p = B2 >> 1; for (m=1; m<=B2_p; m<<=1) { if ((rflag = elldouble(nbc, X, X)) > 1) goto fin; else if (rflag) break; } /* p=3,...,nextprime(B1) */ while (p < B1 && p <= B2_rt) { pari_sp av = avma; p = snextpr(p, &d, &rcn, NULL, miller_k1); B2_p = B2/p; /* beware integer overflow on 32-bit CPUs */ for (m=1; m<=B2_p; m*=p) { if ((rflag = ellmult(nbc, p, X, X, XAUX)) > 1) goto fin; else if (rflag) break; avma = av; } avma = av; } /* primes p larger than sqrt(B2) appear only to the 1st power */ while (p < B1) { pari_sp av = avma; p = snextpr(p, &d, &rcn, NULL, miller_k1); if (ellmult(nbc, p, X, X, XAUX) > 1) goto fin; /* p^2 > B2: no loop */ avma = av; } if (DEBUGLEVEL >= 4) { fprintferr("ECM: time = %6ld ms, B1 phase done, ", timer2()); fprintferr("p = %lu, setting up for B2\n", p); } /* ---B2 PHASE--- */ /* compute [2]Q,...,[10]Q, which we need to build the helix */ if (elldouble(nbc, X, XD) > 1) goto fin; /* [2]Q */ if (elldouble(nbc, XD, XD + nbc2) > 1) goto fin; /* [4]Q */ if (elladd(nbc, XD, XD + nbc2, XD + (nbc<<2)) > 1) goto fin; /* [6]Q */ if (elladd2(nbc, XD, XD + (nbc<<2), XT + (nbc<<3), XD + nbc2, XD + (nbc<<2), XD + (nbc<<3)) > 1) goto fin; /* [8]Q and [10]Q */ if (DEBUGLEVEL >= 7) fprintferr("\t(got [2]Q...[10]Q)\n"); /* get next prime (still using the foolproof test) */ p = snextpr(p, &d, &rcn, NULL, miller_k1); /* make sure we have the residue class number (mod 210) */ if (rcn == NPRC) { rcn = prc210_no[(p % 210) >> 1]; if (rcn == NPRC) { fprintferr("ECM: %lu should have been prime but isn\'t\n", p); err(bugparier, "ellfacteur"); } } /* compute [p]Q and put it into its place in the helix */ if (ellmult(nbc, p, X, XH + rcn*nbc2, XAUX) > 1) goto fin; if (DEBUGLEVEL >= 7) fprintferr("\t(got [p]Q, p = %lu = prc210_rp[%ld] mod 210)\n", p, rcn); /* save current p, d, and rcn; we'll need them more than once below */ p0 = p; d0 = d; rcn0 = rcn; /* remember where the helix wraps */ bstp0 = 0; /* p is at baby-step offset 0 from itself */ /* fill up the helix, stepping forward through the prime residue classes * mod 210 until we're back at the r'class of p0. Keep updating p so * that we can print meaningful diagnostics if a factor shows up; but * don't bother checking which of these p's are in fact prime */ for (i = 47; i; i--) /* 47 iterations */ { p += (dp = (ulong)prc210_d1[rcn]); if (rcn == 47) { /* wrap mod 210 */ if (elladd(nbc, XT + dp*nbc, XH + rcn*nbc2, XH) > 1) goto fin; rcn = 0; continue; } if (elladd(nbc, XT + dp*nbc, XH + rcn*nbc2, XH + rcn*nbc2 + nbc2) > 1) goto fin; rcn++; } if (DEBUGLEVEL >= 7) fprintferr("\t(got initial helix)\n"); /* compute [210]Q etc, which will be needed for the baby step table */ if (ellmult(nbc, 3, XD + (nbc<<3), X, XAUX) > 1) goto fin; if (ellmult(nbc, 7, X, X, XAUX) > 1) goto fin; /* [210]Q */ /* this was the last call to ellmult() in the main loop body; may now * overwrite XAUX and slots XD and following */ if (elldouble(nbc, X, XAUX) > 1) goto fin; /* [420]Q */ if (elladd(nbc, X, XAUX, XT) > 1) goto fin;/* [630]Q */ if (elladd(nbc, X, XT, XD) > 1) goto fin; /* [840]Q */ for (i=1; i <= gse; i++) if (elldouble(nbc, XT + i*nbc2, XD + i*nbc2) > 1) goto fin; /* (the last iteration has initialized XG to [210*2^(gse+1)]Q) */ if (DEBUGLEVEL >= 4) fprintferr("ECM: time = %6ld ms, entering B2 phase, p = %lu\n", timer2(), p); /* inner loop over small sets of 4 curves at a time */ for (i = nbc - 4; i >= 0; i -= 4) { if (DEBUGLEVEL >= 6) fprintferr("ECM: finishing curves %ld...%ld\n", i, i+3); /* copy relevant pointers from XH to Xh. Recall memory layout in XH is * nbc X coordinates followed by nbc Y coordinates for residue class * 1 mod 210, then the same for r.c. 11 mod 210, etc. Memory layout for * Xh is: four X coords for 1 mod 210, four for 11 mod 210, ..., four * for 209 mod 210, then the corresponding Y coordinates in the same * order. This will allow us to do a giant step on Xh using just three * calls to elladd0() each acting on 64 points in parallel */ for (j = 48; j--; ) { k = nbc2*j + i; m = j << 2; /* X coordinates */ Xh[m] = XH[k]; Xh[m+1] = XH[k+1]; Xh[m+2] = XH[k+2]; Xh[m+3] = XH[k+3]; k += nbc; /* Y coordinates */ Yh[m] = XH[k]; Yh[m+1] = XH[k+1]; Yh[m+2] = XH[k+2]; Yh[m+3] = XH[k+3]; } /* build baby step table of X coords of multiples of [210]Q. XB[4*j] * will point at X coords on four curves from [(j+1)*210]Q. Until * we're done, we need some Y coords as well, which we keep in the * second half of the table, overwriting them at the end when gse==10. * Multiples which we already have (by 1,2,3,4,8,16,...,2^gse) are * entered simply by copying the pointers, ignoring the few slots in w * that were initially reserved for them. Here are the initial entries */ for (Xb=XB,k=2,j=i; k--; Xb=XB2,j+=nbc) /* do first X, then Y coords */ { Xb[0] = X[j]; Xb[1] = X[j+1]; /* [210]Q */ Xb[2] = X[j+2]; Xb[3] = X[j+3]; Xb[4] = XAUX[j]; Xb[5] = XAUX[j+1]; /* [420]Q */ Xb[6] = XAUX[j+2]; Xb[7] = XAUX[j+3]; Xb[8] = XT[j]; Xb[9] = XT[j+1]; /* [630]Q */ Xb[10] = XT[j+2]; Xb[11] = XT[j+3]; Xb += 4; /* points at [420]Q */ /* ... entries at powers of 2 times 210 .... */ for (m = 2; m < (ulong)gse+k; m++) /* omit Y coords of [2^gse*210]Q */ { long m2 = m*nbc2 + j; Xb += (2UL<<m); /* points at [2^m*210]Q */ Xb[0] = XAUX[m2]; Xb[1] = XAUX[m2+1]; Xb[2] = XAUX[m2+2]; Xb[3] = XAUX[m2+3]; } } if (DEBUGLEVEL >= 7) fprintferr("\t(extracted precomputed helix / baby step entries)\n"); /* ... glue in between, up to 16*210 ... */ if (elladd0(12, 4, /* 12 pts + (4 pts replicated thrice) */ XB + 12, XB2 + 12, XB, XB2, XB + 16, XB2 + 16) > 1) goto fin; /* 4 + {1,2,3} = {5,6,7} */ if (elladd0(28, 4, /* 28 pts + (4 pts replicated 7fold) */ XB + 28, XB2 + 28, XB, XB2, XB + 32, XB2 + 32) > 1) goto fin; /* 8 + {1,...,7} = {9,...,15} */ /* ... and the remainder of the lot */ for (m = 5; m <= (ulong)gse; m++) { /* fill in from 2^(m-1)+1 to 2^m-1 in chunks of 64 and 60 points */ ulong m2 = 2UL << m; /* will point at 2^(m-1)+1 */ for (j = 0; (ulong)j < m2-64; j+=64) /* executed 0 times when m == 5 */ { if (elladd0(64, 4, XB + m2 - 4, XB2 + m2 - 4, XB + j, XB2 + j, XB + m2 + j, (m<(ulong)gse ? XB2 + m2 + j : NULL)) > 1) goto fin; } /* j == m2-64 here, 60 points left */ if (elladd0(60, 4, XB + m2 - 4, XB2 + m2 - 4, XB + j, XB2 + j, XB + m2 + j, (m<(ulong)gse ? XB2 + m2 + j : NULL)) > 1) goto fin; /* when m==gse, drop Y coords of result, and when both equal 1024, * overwrite Y coords of second argument with X coords of result */ } if (DEBUGLEVEL >= 7) fprintferr("\t(baby step table complete)\n"); /* initialize a few other things */ bstp = bstp0; p = p0; d = d0; rcn = rcn0; gl = gen_1; av1 = avma; /* scratchspace for prod (x_i-x_j) */ avtmp = (pari_sp)new_chunk(8 * lgefint(n)); /* the correct entry in XB to use depends on bstp and on where we are * on the helix. As we skip from prime to prime, bstp will be incre- * mented by snextpr() each time we wrap around through residue class * number 0 (1 mod 210), but the baby step should not be taken until * rcn>=rcn0 (i.e. until we pass again the residue class of p0). * The correct signed multiplier is thus k = bstp - (rcn < rcn0), * and the offset from XB is four times (|k| - 1). When k==0, we may * ignore the current prime (if it had led to a factorization, this * would have been noted during the last giant step, or -- when we * first get here -- whilst initializing the helix). When k > gss, * we must do a giant step and bump bstp back by -2*gss. * The gcd of the product of X coord differences against N is taken just * before we do a giant step. */ /* loop over probable primes p0 < p <= nextprime(B2), inserting giant * steps as necessary */ while (p < B2) { ulong p2 = p; /* save current p for diagnostics */ /* get next probable prime */ p = snextpr(p, &d, &rcn, &bstp, miller_k2); /* work out the corresponding baby-step multiplier */ k = bstp - (rcn < rcn0 ? 1 : 0); /* check whether it's giant-step time */ if (k > gss) { /* take gcd */ gl = gcdii(gl, n); if (!is_pm1(gl) && !equalii(gl, n)) { p = p2; goto fin; } gl = gen_1; avma = av1; while (k > gss) /* hm, just how large are those prime gaps? */ { /* giant step */ if (DEBUGLEVEL >= 7) fprintferr("\t(giant step at p = %lu)\n", p); if (elladd0(64, 4, XG + i, YG + i, Xh, Yh, Xh, Yh) > 1) goto fin; if (elladd0(64, 4, XG + i, YG + i, Xh + 64, Yh + 64, Xh + 64, Yh + 64) > 1) goto fin; if (elladd0(64, 4, XG + i, YG + i, Xh + 128, Yh + 128, Xh + 128, Yh + 128) > 1) goto fin; bstp -= (gss << 1); k = bstp - (rcn < rcn0 ? 1 : 0); /* recompute multiplier */ } } if (!k) continue; /* point of interest is already in Xh */ if (k < 0) k = -k; m = ((ulong)k - 1) << 2; /* accumulate product of differences of X coordinates */ j = rcn<<2; avma = avtmp; /* go to garbage zone */ gl = modii(mulii(gl, subii(XB[m], Xh[j])), n); gl = modii(mulii(gl, subii(XB[m+1], Xh[j+1])), n); gl = modii(mulii(gl, subii(XB[m+2], Xh[j+2])), n); gl = mulii(gl, subii(XB[m+3], Xh[j+3])); avma = av1; gl = modii(gl, n); } /* loop over p */ avma = av1; } /* for i (loop over sets of 4 curves) */ /* continuation part of main loop */ if (dsn < dsnmax) { dsn += insist ? 1 : 2; if (dsn > dsnmax) dsn = dsnmax; } if (!insist && !--rep) { if (DEBUGLEVEL >= 4) { fprintferr("ECM: time = %6ld ms,\tellfacteur giving up.\n", timer2()); flusherr(); } res = NULL; goto ret; } } /* END OF ECM MAIN LOOP */fin: affii(gl, res); if (DEBUGLEVEL >= 4) { fprintferr("ECM: time = %6ld ms,\tp <= %6lu,\n\tfound factor = %Z\n", timer2(), p, res); flusherr(); }ret: if (use_clones) { gunclone(X[spc]); gunclone((GEN)X); } avma = av; return res;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/c5fd2887d753be31ef906548f6e196c4b04c7dab/ifactor1.c/clean/src/basemath/ifactor1.c |
* and insist phases; moreover, repeated non-insistent calls acting on * factors of the same original number should try to use fresh curves. | * and insist phases; moreover, repeated calls acting on factors of the * same original number should try to use fresh curves. | ellfacteur(GEN n, int insist){ static ulong TB1[] = { /* table revised, cf. below 1998Aug15 --GN */ 142,172,208,252,305,370,450,545,661,801,972,1180,1430, 1735,2100,2550,3090,3745,4540,5505,6675,8090,9810,11900, 14420,17490,21200,25700,31160,37780UL,45810UL,55550UL,67350UL, 81660UL,99010UL,120050UL,145550UL,176475UL,213970UL,259430UL, 314550UL,381380UL,462415UL,560660UL,679780UL,824220UL,999340UL, 1211670UL,1469110UL,1781250UL,2159700UL,2618600UL,3175000UL, 3849600UL,4667500UL,5659200UL,6861600UL,8319500UL,10087100UL, 12230300UL,14828900UL,17979600UL,21799700UL,26431500UL, 32047300UL,38856400UL, /* 110 times that still fits into 32bits */#ifdef LONG_IS_64BIT 47112200UL,57122100UL,69258800UL,83974200UL,101816200UL, 123449000UL,149678200UL,181480300UL,220039400UL,266791100UL, 323476100UL,392204900UL,475536500UL,576573500UL,699077800UL, 847610500UL,1027701900UL,1246057200UL,1510806400UL,1831806700UL, 2221009800UL,2692906700UL,3265067200UL,3958794400UL,4799917500UL, /* the only reason to stop here is that I got bored (and that users will * get bored watching their 64bit machines churning on such large numbers * for month after month). Someone can extend this table when the hardware * has gotten 100 times faster than now --GN */#endif }; static ulong TB1_for_stage[] = { /* table revised 1998Aug11 --GN. * Start a little below the optimal B1 for finding factors which would just * have been missed by pollardbrent(), and escalate gradually, changing * curves sufficiently frequently to give good coverage of the small factor * ranges. Entries grow a bit faster than what Paul says would be optimal * but a table instead of a 2D array keeps the code simple */ 500,520,560,620,700,800,900,1000,1150,1300,1450,1600,1800,2000, 2200,2450,2700,2950,3250,3600,4000,4400,4850,5300,5800,6400, 7100,7850,8700,9600,10600,11700,12900,14200,15700,17300, 19000,21000,23200,25500,28000,31000,34500UL,38500UL,43000UL, 48000UL,53800UL,60400UL,67750UL,76000UL,85300UL,95700UL, 107400UL,120500UL,135400UL,152000UL,170800UL,191800UL,215400UL, 241800UL,271400UL,304500UL,341500UL,383100UL,429700UL,481900UL, 540400UL,606000UL,679500UL,761800UL,854100UL,957500UL,1073500UL, }; long nbc,nbc2,dsn,dsnmax,rep,spc,gse,gss,rcn,rcn0,bstp,bstp0; long a, i, j, k, size = expi(n) + 1, tf = lgefint(n); ulong B1,B2,B2_p,B2_rt,m,p,p0,dp; GEN *X,*XAUX,*XT,*XD,*XG,*YG,*XH,*XB,*XB2,*Xh,*Yh,*Xb; GEN res = cgeti(tf); pari_sp av1, avtmp, av = avma; int rflag, use_clones = 0; byteptr d, d0; N = n; /* make n known to auxiliary functions */ /* determine where we'll start, how long we'll persist, and how many * curves we'll use in parallel */ if (insist) { dsnmax = (size >> 2) - 10; if (dsnmax < 0) dsnmax = 0;#ifdef LONG_IS_64BIT else if (dsnmax > 90) dsnmax = 90;#else else if (dsnmax > 65) dsnmax = 65;#endif dsn = (size >> 3) - 5; if (dsn < 0) dsn = 0; else if (dsn > 47) dsn = 47; /* pick up the torch where non-insistent stage would have given up */ nbc = dsn + (dsn >> 2) + 9; /* 8 or more curves in parallel */ nbc &= ~3; /* nbc is always a multiple of 4 */ if (nbc > nbcmax) nbc = nbcmax; a = 1 + (nbcmax<<7); /* seed for choice of curves */ rep = 0; /* gcc -Wall */ } else { dsn = (size - 140) >> 3; if (dsn > 12) dsn = 12; dsnmax = 72; if (dsn < 0) /* < 140 bits: decline the task */ {#ifdef __EMX__ /* MPQS's disk access under DOS/EMX would be abysmally slow, so... */ dsn = 0; rep = 20; nbc = 8;#else if (DEBUGLEVEL >= 4) fprintferr("ECM: number too small to justify this stage\n"); avma = av; return NULL;#endif } else { rep = (size <= 248 ? (size <= 176 ? (size - 124) >> 4 : (size - 148) >> 3) : (size - 224) >> 1); nbc = ((size >> 3) << 2) - 80; if (nbc < 8) nbc = 8; else if (nbc > nbcmax) nbc = nbcmax;#ifdef __EMX__ rep += 20;#endif } /* it may be convenient to use disjoint sets of curves for the non-insist * and insist phases; moreover, repeated non-insistent calls acting on * factors of the same original number should try to use fresh curves. * The following achieves this */ a = 1 + (nbcmax<<3)*(size & 0xf); } if (dsn > dsnmax) dsn = dsnmax; if (DEBUGLEVEL >= 4) { (void)timer2(); fprintferr("ECM: working on %ld curves at a time; initializing", nbc); if (!insist) { if (rep == 1) fprintferr(" for one round"); else fprintferr(" for up to %ld rounds", rep); } fprintferr("...\n"); } /* The auxiliary routines above need < (3*nbc+240)*tf words on the PARI * stack, in addition to the spc*(tf+1) words occupied by our main table. * If stack space is already tight, try the heap, using newbloc(). */ nbc2 = nbc << 1; spc = (13 + 48) * nbc2 + bstpmax * 4;{ const long tw = evallg(tf) | evaltyp(t_INT); GEN w; if ((long)((GEN)avma - (GEN)bot) < spc + 385 + (spc + 3*nbc + 240)*tf) { if (DEBUGLEVEL >= 5) fprintferr("ECM: stack tight, using heap space\n"); use_clones = 1; X = (GEN*)newbloc(spc + 385); w = newbloc(spc*tf); } else { X = (GEN*)new_chunk(spc + 385); w = new_chunk(spc*tf); } /* hack for X[i] = cgeti(tf). X = current point in B1 phase */ for (i = spc; i--; ) { X[i] = w; *w = tw; w += tf; }} XAUX = X + nbc2; /* scratchpad for ellmult() */ XT = XAUX + nbc2; /* ditto, will later hold [3*210]Q */ XD = XT + nbc2; /* room for various multiples */ XB = XD + 10*nbc2; /* start of baby steps table */ XB2 = XB + 2 * bstpmax; /* middle of baby steps table */ XH = XB2 + 2 * bstpmax; /* end of bstps table, start of helix */ Xh = XH + 48*nbc2; /* little helix, X coords */ Yh = XH + 192; /* ditto, Y coords */ /* XG will be set inside the main loop, since it depends on B2 */ /* Xh range of 384 pointers not set; these will later duplicate the pointers * in the XH range, 4 curves at a time. Some of the cells reserved here for * the XB range will never be used, instead, we'll warp the pointers to * connect to (read-only) GENs in the X/XD range; it would be complicated to * skip them here to conserve merely a few KBy of stack or heap space. */ /* ECM MAIN LOOP */ for(;;) { d = diffptr; rcn = NPRC; /* multipliers begin at the beginning */ /* pick curves */ for (i = nbc2; i--; ) affsi(a++, X[i]); /* pick bounds */ B1 = insist ? TB1[dsn] : TB1_for_stage[dsn]; B2 = 110*B1; B2_rt = (ulong)(sqrt((double)B2)); /* pick giant step exponent and size. * With 32 baby steps, a giant step corresponds to 32*420 = 13440, appro- * priate for the smallest B2s. With 1024, a giant step will be 430080; * this will be appropriate for B1 >~ 42000, where 512 baby steps would * imply roughly the same number of E.C. additions. */ gse = B1 < 656 ? (B1 < 200? 5: 6) : (B1 < 10500 ? (B1 < 2625? 7: 8) : (B1 < 42000? 9: 10)); gss = 1UL << gse; XG = XT + gse*nbc2; /* will later hold [2^(gse+1)*210]Q */ YG = XG + nbc; if (DEBUGLEVEL >= 4) { fprintferr("ECM: time = %6ld ms\nECM: dsn = %2ld,\tB1 = %4lu,", timer2(), dsn, B1); fprintferr("\tB2 = %6lu,\tgss = %4ld*420\n", B2, gss); } p = 0; NEXT_PRIME_VIADIFF(p,d); /* ---B1 PHASE--- */ /* treat p=2 separately */ B2_p = B2 >> 1; for (m=1; m<=B2_p; m<<=1) { if ((rflag = elldouble(nbc, X, X)) > 1) goto fin; else if (rflag) break; } /* p=3,...,nextprime(B1) */ while (p < B1 && p <= B2_rt) { pari_sp av = avma; p = snextpr(p, &d, &rcn, NULL, miller_k1); B2_p = B2/p; /* beware integer overflow on 32-bit CPUs */ for (m=1; m<=B2_p; m*=p) { if ((rflag = ellmult(nbc, p, X, X, XAUX)) > 1) goto fin; else if (rflag) break; avma = av; } avma = av; } /* primes p larger than sqrt(B2) appear only to the 1st power */ while (p < B1) { pari_sp av = avma; p = snextpr(p, &d, &rcn, NULL, miller_k1); if (ellmult(nbc, p, X, X, XAUX) > 1) goto fin; /* p^2 > B2: no loop */ avma = av; } if (DEBUGLEVEL >= 4) { fprintferr("ECM: time = %6ld ms, B1 phase done, ", timer2()); fprintferr("p = %lu, setting up for B2\n", p); } /* ---B2 PHASE--- */ /* compute [2]Q,...,[10]Q, which we need to build the helix */ if (elldouble(nbc, X, XD) > 1) goto fin; /* [2]Q */ if (elldouble(nbc, XD, XD + nbc2) > 1) goto fin; /* [4]Q */ if (elladd(nbc, XD, XD + nbc2, XD + (nbc<<2)) > 1) goto fin; /* [6]Q */ if (elladd2(nbc, XD, XD + (nbc<<2), XT + (nbc<<3), XD + nbc2, XD + (nbc<<2), XD + (nbc<<3)) > 1) goto fin; /* [8]Q and [10]Q */ if (DEBUGLEVEL >= 7) fprintferr("\t(got [2]Q...[10]Q)\n"); /* get next prime (still using the foolproof test) */ p = snextpr(p, &d, &rcn, NULL, miller_k1); /* make sure we have the residue class number (mod 210) */ if (rcn == NPRC) { rcn = prc210_no[(p % 210) >> 1]; if (rcn == NPRC) { fprintferr("ECM: %lu should have been prime but isn\'t\n", p); err(bugparier, "ellfacteur"); } } /* compute [p]Q and put it into its place in the helix */ if (ellmult(nbc, p, X, XH + rcn*nbc2, XAUX) > 1) goto fin; if (DEBUGLEVEL >= 7) fprintferr("\t(got [p]Q, p = %lu = prc210_rp[%ld] mod 210)\n", p, rcn); /* save current p, d, and rcn; we'll need them more than once below */ p0 = p; d0 = d; rcn0 = rcn; /* remember where the helix wraps */ bstp0 = 0; /* p is at baby-step offset 0 from itself */ /* fill up the helix, stepping forward through the prime residue classes * mod 210 until we're back at the r'class of p0. Keep updating p so * that we can print meaningful diagnostics if a factor shows up; but * don't bother checking which of these p's are in fact prime */ for (i = 47; i; i--) /* 47 iterations */ { p += (dp = (ulong)prc210_d1[rcn]); if (rcn == 47) { /* wrap mod 210 */ if (elladd(nbc, XT + dp*nbc, XH + rcn*nbc2, XH) > 1) goto fin; rcn = 0; continue; } if (elladd(nbc, XT + dp*nbc, XH + rcn*nbc2, XH + rcn*nbc2 + nbc2) > 1) goto fin; rcn++; } if (DEBUGLEVEL >= 7) fprintferr("\t(got initial helix)\n"); /* compute [210]Q etc, which will be needed for the baby step table */ if (ellmult(nbc, 3, XD + (nbc<<3), X, XAUX) > 1) goto fin; if (ellmult(nbc, 7, X, X, XAUX) > 1) goto fin; /* [210]Q */ /* this was the last call to ellmult() in the main loop body; may now * overwrite XAUX and slots XD and following */ if (elldouble(nbc, X, XAUX) > 1) goto fin; /* [420]Q */ if (elladd(nbc, X, XAUX, XT) > 1) goto fin;/* [630]Q */ if (elladd(nbc, X, XT, XD) > 1) goto fin; /* [840]Q */ for (i=1; i <= gse; i++) if (elldouble(nbc, XT + i*nbc2, XD + i*nbc2) > 1) goto fin; /* (the last iteration has initialized XG to [210*2^(gse+1)]Q) */ if (DEBUGLEVEL >= 4) fprintferr("ECM: time = %6ld ms, entering B2 phase, p = %lu\n", timer2(), p); /* inner loop over small sets of 4 curves at a time */ for (i = nbc - 4; i >= 0; i -= 4) { if (DEBUGLEVEL >= 6) fprintferr("ECM: finishing curves %ld...%ld\n", i, i+3); /* copy relevant pointers from XH to Xh. Recall memory layout in XH is * nbc X coordinates followed by nbc Y coordinates for residue class * 1 mod 210, then the same for r.c. 11 mod 210, etc. Memory layout for * Xh is: four X coords for 1 mod 210, four for 11 mod 210, ..., four * for 209 mod 210, then the corresponding Y coordinates in the same * order. This will allow us to do a giant step on Xh using just three * calls to elladd0() each acting on 64 points in parallel */ for (j = 48; j--; ) { k = nbc2*j + i; m = j << 2; /* X coordinates */ Xh[m] = XH[k]; Xh[m+1] = XH[k+1]; Xh[m+2] = XH[k+2]; Xh[m+3] = XH[k+3]; k += nbc; /* Y coordinates */ Yh[m] = XH[k]; Yh[m+1] = XH[k+1]; Yh[m+2] = XH[k+2]; Yh[m+3] = XH[k+3]; } /* build baby step table of X coords of multiples of [210]Q. XB[4*j] * will point at X coords on four curves from [(j+1)*210]Q. Until * we're done, we need some Y coords as well, which we keep in the * second half of the table, overwriting them at the end when gse==10. * Multiples which we already have (by 1,2,3,4,8,16,...,2^gse) are * entered simply by copying the pointers, ignoring the few slots in w * that were initially reserved for them. Here are the initial entries */ for (Xb=XB,k=2,j=i; k--; Xb=XB2,j+=nbc) /* do first X, then Y coords */ { Xb[0] = X[j]; Xb[1] = X[j+1]; /* [210]Q */ Xb[2] = X[j+2]; Xb[3] = X[j+3]; Xb[4] = XAUX[j]; Xb[5] = XAUX[j+1]; /* [420]Q */ Xb[6] = XAUX[j+2]; Xb[7] = XAUX[j+3]; Xb[8] = XT[j]; Xb[9] = XT[j+1]; /* [630]Q */ Xb[10] = XT[j+2]; Xb[11] = XT[j+3]; Xb += 4; /* points at [420]Q */ /* ... entries at powers of 2 times 210 .... */ for (m = 2; m < (ulong)gse+k; m++) /* omit Y coords of [2^gse*210]Q */ { long m2 = m*nbc2 + j; Xb += (2UL<<m); /* points at [2^m*210]Q */ Xb[0] = XAUX[m2]; Xb[1] = XAUX[m2+1]; Xb[2] = XAUX[m2+2]; Xb[3] = XAUX[m2+3]; } } if (DEBUGLEVEL >= 7) fprintferr("\t(extracted precomputed helix / baby step entries)\n"); /* ... glue in between, up to 16*210 ... */ if (elladd0(12, 4, /* 12 pts + (4 pts replicated thrice) */ XB + 12, XB2 + 12, XB, XB2, XB + 16, XB2 + 16) > 1) goto fin; /* 4 + {1,2,3} = {5,6,7} */ if (elladd0(28, 4, /* 28 pts + (4 pts replicated 7fold) */ XB + 28, XB2 + 28, XB, XB2, XB + 32, XB2 + 32) > 1) goto fin; /* 8 + {1,...,7} = {9,...,15} */ /* ... and the remainder of the lot */ for (m = 5; m <= (ulong)gse; m++) { /* fill in from 2^(m-1)+1 to 2^m-1 in chunks of 64 and 60 points */ ulong m2 = 2UL << m; /* will point at 2^(m-1)+1 */ for (j = 0; (ulong)j < m2-64; j+=64) /* executed 0 times when m == 5 */ { if (elladd0(64, 4, XB + m2 - 4, XB2 + m2 - 4, XB + j, XB2 + j, XB + m2 + j, (m<(ulong)gse ? XB2 + m2 + j : NULL)) > 1) goto fin; } /* j == m2-64 here, 60 points left */ if (elladd0(60, 4, XB + m2 - 4, XB2 + m2 - 4, XB + j, XB2 + j, XB + m2 + j, (m<(ulong)gse ? XB2 + m2 + j : NULL)) > 1) goto fin; /* when m==gse, drop Y coords of result, and when both equal 1024, * overwrite Y coords of second argument with X coords of result */ } if (DEBUGLEVEL >= 7) fprintferr("\t(baby step table complete)\n"); /* initialize a few other things */ bstp = bstp0; p = p0; d = d0; rcn = rcn0; gl = gen_1; av1 = avma; /* scratchspace for prod (x_i-x_j) */ avtmp = (pari_sp)new_chunk(8 * lgefint(n)); /* the correct entry in XB to use depends on bstp and on where we are * on the helix. As we skip from prime to prime, bstp will be incre- * mented by snextpr() each time we wrap around through residue class * number 0 (1 mod 210), but the baby step should not be taken until * rcn>=rcn0 (i.e. until we pass again the residue class of p0). * The correct signed multiplier is thus k = bstp - (rcn < rcn0), * and the offset from XB is four times (|k| - 1). When k==0, we may * ignore the current prime (if it had led to a factorization, this * would have been noted during the last giant step, or -- when we * first get here -- whilst initializing the helix). When k > gss, * we must do a giant step and bump bstp back by -2*gss. * The gcd of the product of X coord differences against N is taken just * before we do a giant step. */ /* loop over probable primes p0 < p <= nextprime(B2), inserting giant * steps as necessary */ while (p < B2) { ulong p2 = p; /* save current p for diagnostics */ /* get next probable prime */ p = snextpr(p, &d, &rcn, &bstp, miller_k2); /* work out the corresponding baby-step multiplier */ k = bstp - (rcn < rcn0 ? 1 : 0); /* check whether it's giant-step time */ if (k > gss) { /* take gcd */ gl = gcdii(gl, n); if (!is_pm1(gl) && !equalii(gl, n)) { p = p2; goto fin; } gl = gen_1; avma = av1; while (k > gss) /* hm, just how large are those prime gaps? */ { /* giant step */ if (DEBUGLEVEL >= 7) fprintferr("\t(giant step at p = %lu)\n", p); if (elladd0(64, 4, XG + i, YG + i, Xh, Yh, Xh, Yh) > 1) goto fin; if (elladd0(64, 4, XG + i, YG + i, Xh + 64, Yh + 64, Xh + 64, Yh + 64) > 1) goto fin; if (elladd0(64, 4, XG + i, YG + i, Xh + 128, Yh + 128, Xh + 128, Yh + 128) > 1) goto fin; bstp -= (gss << 1); k = bstp - (rcn < rcn0 ? 1 : 0); /* recompute multiplier */ } } if (!k) continue; /* point of interest is already in Xh */ if (k < 0) k = -k; m = ((ulong)k - 1) << 2; /* accumulate product of differences of X coordinates */ j = rcn<<2; avma = avtmp; /* go to garbage zone */ gl = modii(mulii(gl, subii(XB[m], Xh[j])), n); gl = modii(mulii(gl, subii(XB[m+1], Xh[j+1])), n); gl = modii(mulii(gl, subii(XB[m+2], Xh[j+2])), n); gl = mulii(gl, subii(XB[m+3], Xh[j+3])); avma = av1; gl = modii(gl, n); } /* loop over p */ avma = av1; } /* for i (loop over sets of 4 curves) */ /* continuation part of main loop */ if (dsn < dsnmax) { dsn += insist ? 1 : 2; if (dsn > dsnmax) dsn = dsnmax; } if (!insist && !--rep) { if (DEBUGLEVEL >= 4) { fprintferr("ECM: time = %6ld ms,\tellfacteur giving up.\n", timer2()); flusherr(); } res = NULL; goto ret; } } /* END OF ECM MAIN LOOP */fin: affii(gl, res); if (DEBUGLEVEL >= 4) { fprintferr("ECM: time = %6ld ms,\tp <= %6lu,\n\tfound factor = %Z\n", timer2(), p, res); flusherr(); }ret: if (use_clones) { gunclone(X[spc]); gunclone((GEN)X); } avma = av; return res;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/c5fd2887d753be31ef906548f6e196c4b04c7dab/ifactor1.c/clean/src/basemath/ifactor1.c |
the_thread ? *the_thread->Object.name : | the_thread ? *(unsigned32 *)the_thread->Object.name : | void Stack_check_Dump_threads_usage( Thread_Control *the_thread){ unsigned32 size, used; void *low; void *high_water_mark; Stack_Control *stack; if ( !the_thread ) return; /* * XXX HACK to get to interrupt stack */ if (the_thread == (Thread_Control *) -1) { if (stack_check_interrupt_stack.area) { stack = &stack_check_interrupt_stack; the_thread = 0; } else return; } else stack = &the_thread->Start.Initial_stack; low = Stack_check_usable_stack_start(stack); size = Stack_check_usable_stack_size(stack); high_water_mark = Stack_check_find_high_water_mark(low, size); if ( high_water_mark ) used = Stack_check_Calculate_used( low, size, high_water_mark ); else used = 0; printf( "0x%08x 0x%08x 0x%08x 0x%08x %8d %8d\n", the_thread ? the_thread->Object.id : ~0, the_thread ? *the_thread->Object.name : rtems_build_name('I', 'N', 'T', 'R'), (unsigned32) stack->area, (unsigned32) stack->area + (unsigned32) stack->size - 1, size, used );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3235ad9a2cd717df901853ad5220a4aaffae84a9/check.c/buggy/c/src/lib/libmisc/stackchk/check.c |
k = 1+bfffo(m); m<<=k; k = BITS_IN_LONG-k; | k = 1+bfffo((ulong)m); m<<=k; k = BITS_IN_LONG-k; | puissii(GEN a, GEN n, long s){ long av,*p,m,k,i,lim; GEN y; if (!signe(a)) return gzero; /* a==0 */ if (lgefint(a)==3) { /* easy if |a| < 3 */ if (a[2] == 1) return (s>0)? gun: negi(gun); if (a[2] == 2) { a = shifti(gun, labs(itos(n))); setsigne(a,s); return a; } } if (lgefint(n)==3) { /* or if |n| < 3 */ if (n[2] == 1) { a = icopy(a); setsigne(a,s); return a; } if (n[2] == 2) return sqri(a); } /* be paranoid about memory consumption */ av=avma; lim=stack_lim(av,1); y = a; p = n+2; m = *p; /* normalize, i.e set highest bit to 1 (we know m != 0) */ k = 1+bfffo(m); m<<=k; k = BITS_IN_LONG-k; /* first bit is now implicit */ for (i=lgefint(n)-2;;) { for (; k; m<<=1,k--) { y = sqri(y); if (m < 0) y = mulii(y,a); /* first bit is set: multiply by base */ if (low_stack(lim, stack_lim(av,1))) { if (DEBUGMEM>1) err(warnmem,"puissii"); y = gerepileuptoint(av,y); } } if (--i == 0) break; m = *++p; k = BITS_IN_LONG; } setsigne(y,s); return gerepileuptoint(av,y);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/6f0450eaf26bb1653fbb257487c2cbc116d69406/trans1.c/buggy/src/basemath/trans1.c |
case t_REAL: av = avma; affrr(rdivii((GEN)x[1],(GEN)x[2], lg(y)), y); avma = av; break; | case t_REAL: rdiviiz((GEN)x[1],(GEN)x[2], y); break; | gaffect(GEN x, GEN y){ long i, j, k, vx, vy, lx, ly, tx = typ(x), ty = typ(y); pari_sp av; GEN p1,num,den; if (tx == ty) switch(tx) { case t_INT: if (!is_universal_constant(y)) { affii(x,y); return; } /* y = gzero, gnil, gun or gdeux */ if (y==gzero) err(overwriter,"gaffect (gzero)"); if (y==gun) err(overwriter,"gaffect (gun)"); if (y==gdeux) err(overwriter,"gaffect (gdeux)"); err(overwriter,"gaffect (gnil)"); case t_REAL: affrr(x,y); return; case t_INTMOD: if (!dvdii((GEN)x[1],(GEN)y[1])) err(operi,"",x,y); modiiz((GEN)x[2],(GEN)y[1],(GEN)y[2]); return; case t_FRAC: affii((GEN)x[1],(GEN)y[1]); affii((GEN)x[2],(GEN)y[2]); return; case t_COMPLEX: gaffect((GEN)x[1],(GEN)y[1]); gaffect((GEN)x[2],(GEN)y[2]); return; case t_PADIC: if (!egalii((GEN)x[2],(GEN)y[2])) err(operi,"",x,y); modiiz((GEN)x[4],(GEN)y[3],(GEN)y[4]); setvalp(y,valp(x)); return; case t_QUAD: if (! gegal((GEN)x[1],(GEN)y[1])) err(operi,"",x,y); affii((GEN)x[2],(GEN)y[2]); affii((GEN)x[3],(GEN)y[3]); return; case t_POLMOD: if (! gdvd((GEN)x[1],(GEN)y[1])) err(operi,"",x,y); gmodz((GEN)x[2],(GEN)y[1],(GEN)y[2]); return; case t_POL: vx = varn(x); vy = varn(y); ly = lg(y); if (vx != vy) { if (varncmp(vy, vx) > 0) err(operf,"",x,y); gaffect(x,(GEN)y[2]); for (i=3; i<ly; i++) gaffsg(0,(GEN)y[i]); y[1] = signe(x)? evalsigne(1)|evalvarn(vy): evalvarn(vy); return; } lx = lg(x); if (lx > ly) err(operi,"",x,y); y[1] = x[1]; for (i=2; i<lx; i++) gaffect((GEN)x[i],(GEN)y[i]); return; case t_SER: vx = varn(x); vy = varn(y); ly = lg(y); if (vx != vy) { if (varncmp(vy, vx) > 0) err(operf,"",x,y); gaffect(x,(GEN)y[2]); if (!signe(x)) y[1] = evalvalp(ly-2) | evalvarn(vy); else y[1] = evalsigne(1) | evalvalp(0) | evalvarn(vy); for (i=3; i<ly; i++) gaffsg(0,(GEN)y[i]); return; } lx = lg(x); if (lx > ly) lx = ly; y[1] = x[1]; for (i=2; i<lx; i++) gaffect((GEN)x[i],(GEN)y[i]); for ( ; i<ly; i++) gaffsg(0,(GEN)y[i]); return; case t_RFRAC: gaffect((GEN)x[1],(GEN)y[1]); gaffect((GEN)x[2],(GEN)y[2]); return; case t_QFR: case t_QFI: case t_VEC: case t_COL: case t_MAT: lx = lg(x); if (lx != lg(y)) err(operi,"",x,y); for (i=1; i<lx; i++) gaffect((GEN)x[i],(GEN)y[i]); return; } if (is_scalar_t(tx)) { if (is_scalar_t(ty)) { switch(tx) { case t_INT: switch(ty) { case t_REAL: if (y == gpi) err(overwriter,"gaffect (gpi)"); if (y==geuler) err(overwriter,"gaffect (geuler)"); affir(x,y); break; case t_INTMOD: modiiz(x,(GEN)y[1],(GEN)y[2]); break; case t_FRAC: if (y == ghalf) err(overwriter,"gaffect (ghalf)"); affii(x,(GEN)y[1]); affsi(1,(GEN)y[2]); break; case t_COMPLEX: if (y == gi) err(overwriter,"gaffect (gi)"); gaffect(x,(GEN)y[1]); gaffsg(0,(GEN)y[2]); break; case t_PADIC: if (!signe(x)) { padicaff0(y); break; } av=avma; setvalp(y, Z_pvalrem(x,(GEN)y[2],&p1)); modiiz(p1,(GEN)y[3],(GEN)y[4]); avma=av; break; case t_QUAD: gaffect(x,(GEN)y[2]); gaffsg(0,(GEN)y[3]); break; case t_POLMOD: gaffect(x,(GEN)y[2]); break; default: err(operf,"",x,y); } break; case t_REAL: switch(ty) { case t_COMPLEX: gaffect(x,(GEN)y[1]); gaffsg(0,(GEN)y[2]); break; case t_POLMOD: gaffect(x,(GEN)y[2]); break; default: err(operf,"",x,y); } break; case t_INTMOD: switch(ty) { case t_POLMOD: gaffect(x,(GEN)y[2]); break; default: err(operf,"",x,y); } break; case t_FRAC: switch(ty) { case t_REAL: av = avma; affrr(rdivii((GEN)x[1],(GEN)x[2], lg(y)), y); avma = av; break; case t_INTMOD: av = avma; p1 = Fp_inv((GEN)x[2],(GEN)y[1]); modiiz(mulii((GEN)x[1],p1),(GEN)y[1],(GEN)y[2]); avma = av; break; case t_COMPLEX: gaffect(x,(GEN)y[1]); gaffsg(0,(GEN)y[2]); break; case t_PADIC: if (!signe(x[1])) { padicaff0(y); break; } num = (GEN)x[1]; den = (GEN)x[2]; av = avma; vx = Z_pvalrem(num, (GEN) y[2], &num); if (!vx) vx = -Z_pvalrem(den,(GEN)y[2],&den); setvalp(y,vx); p1 = mulii(num,Fp_inv(den,(GEN)y[3])); modiiz(p1,(GEN)y[3],(GEN)y[4]); avma = av; break; case t_QUAD: gaffect(x,(GEN)y[2]); gaffsg(0,(GEN)y[3]); break; case t_POLMOD: gaffect(x,(GEN)y[2]); break; default: err(operf,"",x,y); } break; case t_COMPLEX: switch(ty) { case t_INT: case t_REAL: case t_INTMOD: case t_FRAC: case t_PADIC: case t_QUAD: if (!gcmp0((GEN)x[2])) err(operi,"",x,y); gaffect((GEN)x[1],y); break; case t_POLMOD: gaffect(x,(GEN)y[2]); break; default: err(operf,"",x,y); } break; case t_PADIC: switch(ty) { case t_INTMOD: av = avma; affii(ptolift(x, (GEN)y[1]), (GEN)y[2]); avma = av; break; case t_POLMOD: gaffect(x,(GEN)y[2]); break; default: err(operf,"",x,y); } break; case t_QUAD: switch(ty) { case t_INT: case t_INTMOD: case t_FRAC: case t_PADIC: if (!gcmp0((GEN)x[3])) err(operi,"",x,y); gaffect((GEN)x[2],y); break; case t_REAL: av = avma; gaffect(quadtoc(x,lg(y)), y); avma = av; break; case t_COMPLEX: ly = precision(y); if (ly) { av = avma; gaffect(quadtoc(x,ly), y); avma = av; } else { if (!gcmp0((GEN)x[3])) err(operi,"",x,y); gaffect((GEN)x[2],y); } break; case t_POLMOD: gaffect(x,(GEN)y[2]); break; default: err(operf,"",x,y); } break; default: err(operf,"",x,y); } return; } /* here y is not scalar */ switch(ty) { case t_POL: vx = varn(y); ly = lg(y); if (y==polun[vx] || y==polx[vx]) err(overwriter,"gaffect (polun/polx)"); gaffect(x,(GEN)y[2]); for (i=3; i<ly; i++) gaffsg(0,(GEN)y[i]); y[1] = gcmp0(x)? evalvarn(vx): evalsigne(1) | evalvarn(vx); break; case t_SER: vx = varn(y); ly = lg(y); if (gcmp0(x)) y[1] = evalvalp(ly-2) | evalvarn(vx); else y[1] = evalsigne(1) | evalvalp(0) | evalvarn(vx); gaffect(x,(GEN)y[2]); for (i=3; i<ly; i++) gaffsg(0,(GEN)y[i]); break; case t_RFRAC: gaffect(x,(GEN)y[1]); gaffsg(1,(GEN)y[2]); break; default: err(operf,"",x,y); } return; } if (is_const_t(ty)) { entree *varnum, *varden; long vnum, vden; GEN num, den; if (tx == t_POL) { vnum = varn(x); varnum = varentries[ordvar[vnum]]; if (varnum) { x = geval(x); tx = typ(x); if (tx != t_POL || varn(x) != vnum) { gaffect(x, y); return; } } } else if (tx == t_RFRAC) { num = (GEN)x[1]; vnum = gvar(num); varnum = varentries[ordvar[vnum]]; den = (GEN)x[2]; vden = gvar(den); varden = varentries[ordvar[vden]]; if (varnum && varden) { vnum = min(vnum, vden); x = geval(x); tx = typ(x); if (tx != t_RFRAC || gvar(x) != vnum) { gaffect(x, y); return; } } } err(operf,"",x,y); } lx = lg(x); ly = lg(y); switch(tx) { case t_POL: vx = varn(x); switch(ty) { case t_POLMOD: gmodz(x,(GEN)y[1],(GEN)y[2]); break; case t_SER: vy=varn(y); if (varncmp(vy, vx) > 0) err(operf,"",x,y); if (!signe(x)) { gaffsg(0,y); return; } if (vy==vx) { i = gval(x,vx); y[1] = evalvarn(vx) | evalvalp(i) | evalsigne(1); k = lx-i; if (k > ly) k = ly; for (j=2; j<k; j++) gaffect((GEN)x[i+j],(GEN)y[j]); for ( ; j<ly; j++) gaffsg(0,(GEN)y[j]); } else { gaffect(x,(GEN)y[2]); if (!signe(x)) y[1] = evalvalp(ly-2) | evalvarn(vy); else y[1] = evalsigne(1) | evalvalp(0) | evalvarn(vy); for (i=3; i<ly; i++) gaffsg(0,(GEN)y[i]); } break; case t_RFRAC: gaffect(x,(GEN)y[1]); gaffsg(1,(GEN)y[2]); break; default: err(operf,"",x,y); } break; case t_RFRAC: switch(ty) { case t_POLMOD: av=avma; p1=ginvmod((GEN)x[2],(GEN)y[1]); gmodz(gmul((GEN)x[1],p1),(GEN)y[1],(GEN)y[2]); avma=av; break; case t_SER: gdivz((GEN)x[1],(GEN)x[2],y); break; default: err(operf,"",x,y); } break; default: err(operf,"",x,y); }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/51508448a0e0a60edbdf6a936ab3506685a4b139/gen2.c/buggy/src/basemath/gen2.c |
while( final_address > d_addr ) { | while( final_address >= d_addr ) { | rtems_cache_invalidate_multiple_data_lines( const void * d_addr, size_t n_bytes ){#if defined(CPU_DATA_CACHE_ALIGNMENT) const void * final_address; /* * Set d_addr to the beginning of the cache line; final_address indicates * the last address_t which needs to be invalidated. Increment d_addr and * invalidate the resulting line until final_address is passed. */ if( n_bytes == 0 ) /* Do nothing if number of bytes to invalidate is zero */ return; final_address = (void *)((size_t)d_addr + n_bytes - 1); d_addr = (void *)((size_t)d_addr & ~(CPU_DATA_CACHE_ALIGNMENT - 1)); while( final_address > d_addr ) { _CPU_cache_invalidate_1_data_line( d_addr ); d_addr = (void *)((size_t)d_addr + CPU_DATA_CACHE_ALIGNMENT); }#endif} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ec45e86d79e589ab1ea690c1b9a4ee265980fcca/cache_manager.c/buggy/c/src/lib/libcpu/shared/src/cache_manager.c |
s = a; a = b; b = s; /* in order to keep the right signs */ | cbezout(long a,long b,long *uu,long *vv){ long s,*t; ulong d = labs(a), d1 = labs(b); ulong r,u,u1,v,v1;#ifdef DEBUG_CBEZOUT fprintferr("> cbezout(%ld,%ld,%p,%p)\n", a, b, (void *)uu, (void *)vv);#endif if (!b) { *vv=0L; if (!a) { *uu=1L;#ifdef DEBUG_CBEZOUT fprintferr("< %ld (%ld, %ld)\n", 1L, *uu, *vv);#endif return 0L; } *uu = a < 0 ? -1L : 1L;#ifdef DEBUG_CBEZOUT fprintferr("< %ld (%ld, %ld)\n", (long)d, *uu, *vv);#endif return (long)d; } else if (!a || (d == d1)) { *uu = 0L; *vv = b < 0 ? -1L : 1L;#ifdef DEBUG_CBEZOUT fprintferr("< %ld (%ld, %ld)\n", (long)d1, *uu, *vv);#endif return (long)d1; } else if (d == 1) /* frequently used by nfinit */ { *uu = a; *vv = 0L;#ifdef DEBUG_CBEZOUT fprintferr("< %ld (%ld, %ld)\n", 1L, *uu, *vv);#endif return 1L; } else if (d < d1) { r = d; d = d1; d1 = r; s = a; a = b; b = s; /* in order to keep the right signs */ t = uu; uu = vv; vv = t;#ifdef DEBUG_CBEZOUT fprintferr(" swapping\n");#endif } /* d > d1 > 0 */ r = xxgcduu(d, d1, 0, &u, &u1, &v, &v1, &s); if (s < 0) { *uu = a < 0 ? u : -(long)u; *vv = b < 0 ? -(long)v : v; } else { *uu = a < 0 ? -(long)u : u; *vv = b < 0 ? v : -(long)v; }#ifdef DEBUG_CBEZOUT fprintferr("< %ld (%ld, %ld)\n", (long)r, *uu, *vv);#endif return (long)r;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/c339a8c1ebe14036f0dc9ed88a3e019a72bf2447/mp.c/buggy/src/kernel/none/mp.c |
|
prec = gprecision(x); | prec = gprecision(x) - 1; /* don't trust the last word */ | init_pslq(pslq_M *M, GEN x, long *PREC){ long tx = typ(x), lx = lg(x), n = lx-1, i, j, k, prec; GEN s1, s, sinv; if (! is_vec_t(tx)) err(typeer,"pslq"); /* check trivial cases */ for (k = 1; k <= n; k++) if (gcmp0((GEN)x[k])) return vec_ei(n, k); if (n <= 1) return cgetg(1, t_COL); prec = gprecision(x); if (prec < 0) { /* exact components */ pari_sp av = avma; GEN im, U = NULL; x = Q_primpart(x); im = gimag(x); x = greal(x); settyp(x, t_VEC); if (!gcmp0(im)) { U = (GEN)extendedgcd(im)[2]; setlg(U, lg(U)-1); /* remove last column */ x = gmul(x, U); if (n == 2) /* x has a single component */ return gcmp0((GEN)x[1])? (GEN)U[1]: cgetg(1, t_COL); } x = (GEN)extendedgcd(x)[2]; x = (GEN)x[1]; if (U) x = gmul(U, x); return gerepilecopy(av, x); } if (prec < DEFAULTPREC) prec = DEFAULTPREC; *PREC = prec; M->EXP = - bit_accuracy(prec) + max(2*n, 32); M->flreal = is_zero(gimag(x), M->EXP, prec); if (!M->flreal) return lindep(x,prec); /* FIXME */ else x = greal(x); if (DEBUGLEVEL>=3) { (void)timer(); init_timer(M->T); } x = col_to_MP(x, prec); settyp(x,t_VEC); M->n = n; M->A = idmat(n); M->B = idmat(n); s1 = cgetg(lx,t_VEC); s1[n] = lnorm((GEN)x[n]); s = cgetg(lx,t_VEC); s[n] = (long)gabs((GEN)x[n],prec); for (k=n-1; k>=1; k--) { s1[k] = ladd((GEN)s1[k+1], gnorm((GEN)x[k])); s[k] = (long)gsqrt((GEN)s1[k], prec); } sinv = ginv((GEN)s[1]); s = gmul(sinv,s); M->y = gmul(sinv, x); M->H = cgetg(n,t_MAT); for (j=1; j<n; j++) { GEN d, c = cgetg(lx,t_COL); M->H[j] = (long)c; for (i=1; i<j; i++) c[i] = zero; c[j] = ldiv((GEN)s[j+1],(GEN)s[j]); d = gneg( gdiv((GEN)M->y[j], gmul((GEN)s[j],(GEN)s[j+1]) )); for (i=j+1; i<=n; i++) c[i] = lmul(gconj((GEN)M->y[i]), d); } for (i=2; i<=n; i++) redall(M, i, i-1); return NULL;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/4d7fe7ed47db14665b6026b185bec4904295467c/bibli1.c/buggy/src/basemath/bibli1.c |
M->EXP = - bit_accuracy(prec) + max(2*n, 32); | M->EXP = - bit_accuracy(prec) + max(n, 8); | init_pslq(pslq_M *M, GEN x, long *PREC){ long tx = typ(x), lx = lg(x), n = lx-1, i, j, k, prec; GEN s1, s, sinv; if (! is_vec_t(tx)) err(typeer,"pslq"); /* check trivial cases */ for (k = 1; k <= n; k++) if (gcmp0((GEN)x[k])) return vec_ei(n, k); if (n <= 1) return cgetg(1, t_COL); prec = gprecision(x); if (prec < 0) { /* exact components */ pari_sp av = avma; GEN im, U = NULL; x = Q_primpart(x); im = gimag(x); x = greal(x); settyp(x, t_VEC); if (!gcmp0(im)) { U = (GEN)extendedgcd(im)[2]; setlg(U, lg(U)-1); /* remove last column */ x = gmul(x, U); if (n == 2) /* x has a single component */ return gcmp0((GEN)x[1])? (GEN)U[1]: cgetg(1, t_COL); } x = (GEN)extendedgcd(x)[2]; x = (GEN)x[1]; if (U) x = gmul(U, x); return gerepilecopy(av, x); } if (prec < DEFAULTPREC) prec = DEFAULTPREC; *PREC = prec; M->EXP = - bit_accuracy(prec) + max(2*n, 32); M->flreal = is_zero(gimag(x), M->EXP, prec); if (!M->flreal) return lindep(x,prec); /* FIXME */ else x = greal(x); if (DEBUGLEVEL>=3) { (void)timer(); init_timer(M->T); } x = col_to_MP(x, prec); settyp(x,t_VEC); M->n = n; M->A = idmat(n); M->B = idmat(n); s1 = cgetg(lx,t_VEC); s1[n] = lnorm((GEN)x[n]); s = cgetg(lx,t_VEC); s[n] = (long)gabs((GEN)x[n],prec); for (k=n-1; k>=1; k--) { s1[k] = ladd((GEN)s1[k+1], gnorm((GEN)x[k])); s[k] = (long)gsqrt((GEN)s1[k], prec); } sinv = ginv((GEN)s[1]); s = gmul(sinv,s); M->y = gmul(sinv, x); M->H = cgetg(n,t_MAT); for (j=1; j<n; j++) { GEN d, c = cgetg(lx,t_COL); M->H[j] = (long)c; for (i=1; i<j; i++) c[i] = zero; c[j] = ldiv((GEN)s[j+1],(GEN)s[j]); d = gneg( gdiv((GEN)M->y[j], gmul((GEN)s[j],(GEN)s[j+1]) )); for (i=j+1; i<=n; i++) c[i] = lmul(gconj((GEN)M->y[i]), d); } for (i=2; i<=n; i++) redall(M, i, i-1); return NULL;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/4d7fe7ed47db14665b6026b185bec4904295467c/bibli1.c/buggy/src/basemath/bibli1.c |
if (rn_inithead((void **)&mask_rnhead, 0) == 0) | if (rn_inithead((void *)&mask_rnhead, 0) == 0) | rn_init(){ char *cp, *cplim;#ifdef KERNEL struct domain *dom; for (dom = domains; dom; dom = dom->dom_next) if (dom->dom_maxrtkey > max_keylen) max_keylen = dom->dom_maxrtkey;#endif if (max_keylen == 0) { log(LOG_ERR, "rn_init: radix functions require max_keylen be set\n"); return; } R_Malloc(rn_zeros, char *, 3 * max_keylen); if (rn_zeros == NULL) panic("rn_init"); Bzero(rn_zeros, 3 * max_keylen); rn_ones = cp = rn_zeros + max_keylen; addmask_key = cplim = rn_ones + max_keylen; while (cp < cplim) *cp++ = -1; if (rn_inithead((void **)&mask_rnhead, 0) == 0) panic("rn_init 2");} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/b2b143f402b30c7bbe4ee98c58221b0cc78a1e9e/radix.c/buggy/cpukit/libnetworking/net/radix.c |
GEN f, fZ, basecl, module, fa, fa2, *listpr, *listep, *vecinvpi, *vectau; GEN pr, t, EX, sarch, cyc, F; | GEN f, fZ, basecl, module, fa, fa2, pr, t, EX, sarch, cyc, F; GEN *listpr, *listep, *vecpi, *vecpinvpi, *vectau; | compute_raygen(GEN nf, GEN u1, GEN gen, GEN bid){ GEN f, fZ, basecl, module, fa, fa2, *listpr, *listep, *vecinvpi, *vectau; GEN pr, t, EX, sarch, cyc, F; long i,j,l,lp; /* basecl = generators in factored form */ basecl = compute_fact(nf,u1,gen); module = (GEN)bid[1]; cyc = gmael(bid,2,2); EX = (GEN)cyc[1]; /* exponent of (O/f)^* */ f = (GEN)module[1]; fZ = gcoeff(f,1,1); fa = (GEN)bid[3]; fa2 = (GEN)bid[4]; sarch = (GEN)fa2[lg(fa2)-1]; listpr = (GEN*)fa[1]; F = init_unif_mod_fZ((GEN)listpr); listep = (GEN*)fa[2]; lp = lg(listpr); vecinvpi = (GEN*)cgetg(lp, t_VEC); vectau = (GEN*)cgetg(lp, t_VEC); for (i=1; i<lp; i++) { pr = listpr[i]; vecinvpi[i] = NULL; /* to be computed if needed */ vectau[i] = eltmul_get_table(nf, (GEN)pr[5]); } l = lg(basecl); for (i=1; i<l; i++) { GEN invpi, dmulI, mulI, G, I, A, e, L, newL; long la, v, k; /* G = [I, A=famat(L,e)] is a generator, I integral */ G = (GEN)basecl[i]; I = (GEN)G[1]; A = (GEN)G[2]; L = (GEN)A[1]; e = (GEN)A[2]; /* if no reduction took place in compute_fact, everybody is still coprime * to f + no denominators */ if (!I) { basecl[i] = (long)famat_to_nf_modidele(nf, L, e, bid); continue; } if (lg(A) == 1) { basecl[i] = (long)I; continue; } /* compute mulI so that mulI * I coprime to f * FIXME: use idealcoprime ??? (Less efficient. Fix idealcoprime!) */ dmulI = mulI = NULL; for (j=1; j<lp; j++) { pr = listpr[j]; v = idealval(nf, I, pr); if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf, invpi, stoi(v)); mulI = mulI? element_mul(nf, mulI, t): t; t = gpowgs((GEN)pr[1], v); dmulI = dmulI? mulii(dmulI, t): t; } /* make all components of L coprime to f. * Assuming (L^e * I, f) = 1, then newL^e * mulI = L^e */ la = lg(e); newL = cgetg(la, t_VEC); for (k=1; k<la; k++) { GEN L0, cx, LL = _algtobasis(nf, (GEN)L[k]); L0 = Q_primitive_part(LL, &cx); /* LL = L0*cx (faster element_val) */ for (j=1; j<lp; j++) { pr = listpr[j]; v = fast_val(nf, L0,cx, pr,vectau[j]); /* = val_pr(LL) */ if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf,invpi,stoi(v)); LL = element_mul(nf, LL, t); LL = gdivexact(LL, gpowgs((GEN)pr[1], v)); } newL[k] = (long)FpV_red(make_integral(LL,fZ), fZ); } /* G in nf, = L^e mod f */ G = famat_to_nf_modideal_coprime(nf, newL, gmod(e,EX), f); if (mulI) { G = element_muli(nf, G, mulI); G = colreducemodHNF(G, gmul(f, dmulI), NULL); } G = set_sign_mod_idele(nf,A,G,module,sarch); I = idealmul(nf,I,G); if (dmulI) I = gdivexact(I, dmulI); /* more or less useless, but cheap at this point */ I = _idealmodidele(nf,I,module,sarch); basecl[i] = (long)I; } return basecl;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/4cd73225d697f865e8e6fd767f513c71c0cc5a79/buch3.c/buggy/src/basemath/buch3.c |
vecinvpi = (GEN*)cgetg(lp, t_VEC); | vecpinvpi = (GEN*)cgetg(lp, t_VEC); vecpi = (GEN*)cgetg(lp, t_VEC); | compute_raygen(GEN nf, GEN u1, GEN gen, GEN bid){ GEN f, fZ, basecl, module, fa, fa2, *listpr, *listep, *vecinvpi, *vectau; GEN pr, t, EX, sarch, cyc, F; long i,j,l,lp; /* basecl = generators in factored form */ basecl = compute_fact(nf,u1,gen); module = (GEN)bid[1]; cyc = gmael(bid,2,2); EX = (GEN)cyc[1]; /* exponent of (O/f)^* */ f = (GEN)module[1]; fZ = gcoeff(f,1,1); fa = (GEN)bid[3]; fa2 = (GEN)bid[4]; sarch = (GEN)fa2[lg(fa2)-1]; listpr = (GEN*)fa[1]; F = init_unif_mod_fZ((GEN)listpr); listep = (GEN*)fa[2]; lp = lg(listpr); vecinvpi = (GEN*)cgetg(lp, t_VEC); vectau = (GEN*)cgetg(lp, t_VEC); for (i=1; i<lp; i++) { pr = listpr[i]; vecinvpi[i] = NULL; /* to be computed if needed */ vectau[i] = eltmul_get_table(nf, (GEN)pr[5]); } l = lg(basecl); for (i=1; i<l; i++) { GEN invpi, dmulI, mulI, G, I, A, e, L, newL; long la, v, k; /* G = [I, A=famat(L,e)] is a generator, I integral */ G = (GEN)basecl[i]; I = (GEN)G[1]; A = (GEN)G[2]; L = (GEN)A[1]; e = (GEN)A[2]; /* if no reduction took place in compute_fact, everybody is still coprime * to f + no denominators */ if (!I) { basecl[i] = (long)famat_to_nf_modidele(nf, L, e, bid); continue; } if (lg(A) == 1) { basecl[i] = (long)I; continue; } /* compute mulI so that mulI * I coprime to f * FIXME: use idealcoprime ??? (Less efficient. Fix idealcoprime!) */ dmulI = mulI = NULL; for (j=1; j<lp; j++) { pr = listpr[j]; v = idealval(nf, I, pr); if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf, invpi, stoi(v)); mulI = mulI? element_mul(nf, mulI, t): t; t = gpowgs((GEN)pr[1], v); dmulI = dmulI? mulii(dmulI, t): t; } /* make all components of L coprime to f. * Assuming (L^e * I, f) = 1, then newL^e * mulI = L^e */ la = lg(e); newL = cgetg(la, t_VEC); for (k=1; k<la; k++) { GEN L0, cx, LL = _algtobasis(nf, (GEN)L[k]); L0 = Q_primitive_part(LL, &cx); /* LL = L0*cx (faster element_val) */ for (j=1; j<lp; j++) { pr = listpr[j]; v = fast_val(nf, L0,cx, pr,vectau[j]); /* = val_pr(LL) */ if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf,invpi,stoi(v)); LL = element_mul(nf, LL, t); LL = gdivexact(LL, gpowgs((GEN)pr[1], v)); } newL[k] = (long)FpV_red(make_integral(LL,fZ), fZ); } /* G in nf, = L^e mod f */ G = famat_to_nf_modideal_coprime(nf, newL, gmod(e,EX), f); if (mulI) { G = element_muli(nf, G, mulI); G = colreducemodHNF(G, gmul(f, dmulI), NULL); } G = set_sign_mod_idele(nf,A,G,module,sarch); I = idealmul(nf,I,G); if (dmulI) I = gdivexact(I, dmulI); /* more or less useless, but cheap at this point */ I = _idealmodidele(nf,I,module,sarch); basecl[i] = (long)I; } return basecl;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/4cd73225d697f865e8e6fd767f513c71c0cc5a79/buch3.c/buggy/src/basemath/buch3.c |
vecinvpi[i] = NULL; /* to be computed if needed */ | vecpi[i] = NULL; /* to be computed if needed */ vecpinvpi[i] = NULL; /* to be computed if needed */ | compute_raygen(GEN nf, GEN u1, GEN gen, GEN bid){ GEN f, fZ, basecl, module, fa, fa2, *listpr, *listep, *vecinvpi, *vectau; GEN pr, t, EX, sarch, cyc, F; long i,j,l,lp; /* basecl = generators in factored form */ basecl = compute_fact(nf,u1,gen); module = (GEN)bid[1]; cyc = gmael(bid,2,2); EX = (GEN)cyc[1]; /* exponent of (O/f)^* */ f = (GEN)module[1]; fZ = gcoeff(f,1,1); fa = (GEN)bid[3]; fa2 = (GEN)bid[4]; sarch = (GEN)fa2[lg(fa2)-1]; listpr = (GEN*)fa[1]; F = init_unif_mod_fZ((GEN)listpr); listep = (GEN*)fa[2]; lp = lg(listpr); vecinvpi = (GEN*)cgetg(lp, t_VEC); vectau = (GEN*)cgetg(lp, t_VEC); for (i=1; i<lp; i++) { pr = listpr[i]; vecinvpi[i] = NULL; /* to be computed if needed */ vectau[i] = eltmul_get_table(nf, (GEN)pr[5]); } l = lg(basecl); for (i=1; i<l; i++) { GEN invpi, dmulI, mulI, G, I, A, e, L, newL; long la, v, k; /* G = [I, A=famat(L,e)] is a generator, I integral */ G = (GEN)basecl[i]; I = (GEN)G[1]; A = (GEN)G[2]; L = (GEN)A[1]; e = (GEN)A[2]; /* if no reduction took place in compute_fact, everybody is still coprime * to f + no denominators */ if (!I) { basecl[i] = (long)famat_to_nf_modidele(nf, L, e, bid); continue; } if (lg(A) == 1) { basecl[i] = (long)I; continue; } /* compute mulI so that mulI * I coprime to f * FIXME: use idealcoprime ??? (Less efficient. Fix idealcoprime!) */ dmulI = mulI = NULL; for (j=1; j<lp; j++) { pr = listpr[j]; v = idealval(nf, I, pr); if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf, invpi, stoi(v)); mulI = mulI? element_mul(nf, mulI, t): t; t = gpowgs((GEN)pr[1], v); dmulI = dmulI? mulii(dmulI, t): t; } /* make all components of L coprime to f. * Assuming (L^e * I, f) = 1, then newL^e * mulI = L^e */ la = lg(e); newL = cgetg(la, t_VEC); for (k=1; k<la; k++) { GEN L0, cx, LL = _algtobasis(nf, (GEN)L[k]); L0 = Q_primitive_part(LL, &cx); /* LL = L0*cx (faster element_val) */ for (j=1; j<lp; j++) { pr = listpr[j]; v = fast_val(nf, L0,cx, pr,vectau[j]); /* = val_pr(LL) */ if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf,invpi,stoi(v)); LL = element_mul(nf, LL, t); LL = gdivexact(LL, gpowgs((GEN)pr[1], v)); } newL[k] = (long)FpV_red(make_integral(LL,fZ), fZ); } /* G in nf, = L^e mod f */ G = famat_to_nf_modideal_coprime(nf, newL, gmod(e,EX), f); if (mulI) { G = element_muli(nf, G, mulI); G = colreducemodHNF(G, gmul(f, dmulI), NULL); } G = set_sign_mod_idele(nf,A,G,module,sarch); I = idealmul(nf,I,G); if (dmulI) I = gdivexact(I, dmulI); /* more or less useless, but cheap at this point */ I = _idealmodidele(nf,I,module,sarch); basecl[i] = (long)I; } return basecl;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/4cd73225d697f865e8e6fd767f513c71c0cc5a79/buch3.c/buggy/src/basemath/buch3.c |
GEN invpi, dmulI, mulI, G, I, A, e, L, newL; | GEN p, pi, pinvpi, dmulI, mulI, G, I, A, e, L, newL; | compute_raygen(GEN nf, GEN u1, GEN gen, GEN bid){ GEN f, fZ, basecl, module, fa, fa2, *listpr, *listep, *vecinvpi, *vectau; GEN pr, t, EX, sarch, cyc, F; long i,j,l,lp; /* basecl = generators in factored form */ basecl = compute_fact(nf,u1,gen); module = (GEN)bid[1]; cyc = gmael(bid,2,2); EX = (GEN)cyc[1]; /* exponent of (O/f)^* */ f = (GEN)module[1]; fZ = gcoeff(f,1,1); fa = (GEN)bid[3]; fa2 = (GEN)bid[4]; sarch = (GEN)fa2[lg(fa2)-1]; listpr = (GEN*)fa[1]; F = init_unif_mod_fZ((GEN)listpr); listep = (GEN*)fa[2]; lp = lg(listpr); vecinvpi = (GEN*)cgetg(lp, t_VEC); vectau = (GEN*)cgetg(lp, t_VEC); for (i=1; i<lp; i++) { pr = listpr[i]; vecinvpi[i] = NULL; /* to be computed if needed */ vectau[i] = eltmul_get_table(nf, (GEN)pr[5]); } l = lg(basecl); for (i=1; i<l; i++) { GEN invpi, dmulI, mulI, G, I, A, e, L, newL; long la, v, k; /* G = [I, A=famat(L,e)] is a generator, I integral */ G = (GEN)basecl[i]; I = (GEN)G[1]; A = (GEN)G[2]; L = (GEN)A[1]; e = (GEN)A[2]; /* if no reduction took place in compute_fact, everybody is still coprime * to f + no denominators */ if (!I) { basecl[i] = (long)famat_to_nf_modidele(nf, L, e, bid); continue; } if (lg(A) == 1) { basecl[i] = (long)I; continue; } /* compute mulI so that mulI * I coprime to f * FIXME: use idealcoprime ??? (Less efficient. Fix idealcoprime!) */ dmulI = mulI = NULL; for (j=1; j<lp; j++) { pr = listpr[j]; v = idealval(nf, I, pr); if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf, invpi, stoi(v)); mulI = mulI? element_mul(nf, mulI, t): t; t = gpowgs((GEN)pr[1], v); dmulI = dmulI? mulii(dmulI, t): t; } /* make all components of L coprime to f. * Assuming (L^e * I, f) = 1, then newL^e * mulI = L^e */ la = lg(e); newL = cgetg(la, t_VEC); for (k=1; k<la; k++) { GEN L0, cx, LL = _algtobasis(nf, (GEN)L[k]); L0 = Q_primitive_part(LL, &cx); /* LL = L0*cx (faster element_val) */ for (j=1; j<lp; j++) { pr = listpr[j]; v = fast_val(nf, L0,cx, pr,vectau[j]); /* = val_pr(LL) */ if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf,invpi,stoi(v)); LL = element_mul(nf, LL, t); LL = gdivexact(LL, gpowgs((GEN)pr[1], v)); } newL[k] = (long)FpV_red(make_integral(LL,fZ), fZ); } /* G in nf, = L^e mod f */ G = famat_to_nf_modideal_coprime(nf, newL, gmod(e,EX), f); if (mulI) { G = element_muli(nf, G, mulI); G = colreducemodHNF(G, gmul(f, dmulI), NULL); } G = set_sign_mod_idele(nf,A,G,module,sarch); I = idealmul(nf,I,G); if (dmulI) I = gdivexact(I, dmulI); /* more or less useless, but cheap at this point */ I = _idealmodidele(nf,I,module,sarch); basecl[i] = (long)I; } return basecl;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/4cd73225d697f865e8e6fd767f513c71c0cc5a79/buch3.c/buggy/src/basemath/buch3.c |
invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf, invpi, stoi(v)); | p = (GEN)pr[1]; pi = get_pi(F, pr, &vecpi[j]); pinvpi = get_pinvpi(nf, fZ, p, pi, &vecpinvpi[j]); t = element_pow(nf, pinvpi, stoi(v)); | compute_raygen(GEN nf, GEN u1, GEN gen, GEN bid){ GEN f, fZ, basecl, module, fa, fa2, *listpr, *listep, *vecinvpi, *vectau; GEN pr, t, EX, sarch, cyc, F; long i,j,l,lp; /* basecl = generators in factored form */ basecl = compute_fact(nf,u1,gen); module = (GEN)bid[1]; cyc = gmael(bid,2,2); EX = (GEN)cyc[1]; /* exponent of (O/f)^* */ f = (GEN)module[1]; fZ = gcoeff(f,1,1); fa = (GEN)bid[3]; fa2 = (GEN)bid[4]; sarch = (GEN)fa2[lg(fa2)-1]; listpr = (GEN*)fa[1]; F = init_unif_mod_fZ((GEN)listpr); listep = (GEN*)fa[2]; lp = lg(listpr); vecinvpi = (GEN*)cgetg(lp, t_VEC); vectau = (GEN*)cgetg(lp, t_VEC); for (i=1; i<lp; i++) { pr = listpr[i]; vecinvpi[i] = NULL; /* to be computed if needed */ vectau[i] = eltmul_get_table(nf, (GEN)pr[5]); } l = lg(basecl); for (i=1; i<l; i++) { GEN invpi, dmulI, mulI, G, I, A, e, L, newL; long la, v, k; /* G = [I, A=famat(L,e)] is a generator, I integral */ G = (GEN)basecl[i]; I = (GEN)G[1]; A = (GEN)G[2]; L = (GEN)A[1]; e = (GEN)A[2]; /* if no reduction took place in compute_fact, everybody is still coprime * to f + no denominators */ if (!I) { basecl[i] = (long)famat_to_nf_modidele(nf, L, e, bid); continue; } if (lg(A) == 1) { basecl[i] = (long)I; continue; } /* compute mulI so that mulI * I coprime to f * FIXME: use idealcoprime ??? (Less efficient. Fix idealcoprime!) */ dmulI = mulI = NULL; for (j=1; j<lp; j++) { pr = listpr[j]; v = idealval(nf, I, pr); if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf, invpi, stoi(v)); mulI = mulI? element_mul(nf, mulI, t): t; t = gpowgs((GEN)pr[1], v); dmulI = dmulI? mulii(dmulI, t): t; } /* make all components of L coprime to f. * Assuming (L^e * I, f) = 1, then newL^e * mulI = L^e */ la = lg(e); newL = cgetg(la, t_VEC); for (k=1; k<la; k++) { GEN L0, cx, LL = _algtobasis(nf, (GEN)L[k]); L0 = Q_primitive_part(LL, &cx); /* LL = L0*cx (faster element_val) */ for (j=1; j<lp; j++) { pr = listpr[j]; v = fast_val(nf, L0,cx, pr,vectau[j]); /* = val_pr(LL) */ if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf,invpi,stoi(v)); LL = element_mul(nf, LL, t); LL = gdivexact(LL, gpowgs((GEN)pr[1], v)); } newL[k] = (long)FpV_red(make_integral(LL,fZ), fZ); } /* G in nf, = L^e mod f */ G = famat_to_nf_modideal_coprime(nf, newL, gmod(e,EX), f); if (mulI) { G = element_muli(nf, G, mulI); G = colreducemodHNF(G, gmul(f, dmulI), NULL); } G = set_sign_mod_idele(nf,A,G,module,sarch); I = idealmul(nf,I,G); if (dmulI) I = gdivexact(I, dmulI); /* more or less useless, but cheap at this point */ I = _idealmodidele(nf,I,module,sarch); basecl[i] = (long)I; } return basecl;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/4cd73225d697f865e8e6fd767f513c71c0cc5a79/buch3.c/buggy/src/basemath/buch3.c |
invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf,invpi,stoi(v)); LL = element_mul(nf, LL, t); LL = gdivexact(LL, gpowgs((GEN)pr[1], v)); | p = (GEN)pr[1]; pi = get_pi(F, pr, &vecpi[j]); if (v > 0) { pinvpi = get_pinvpi(nf, fZ, p, pi, &vecpinvpi[j]); t = element_pow(nf,pinvpi,stoi(v)); LL = element_mul(nf, LL, t); LL = gdiv(LL, gpowgs(p, v)); } else { t = element_pow(nf,pi,stoi(-v)); LL = element_mul(nf, LL, t); } | compute_raygen(GEN nf, GEN u1, GEN gen, GEN bid){ GEN f, fZ, basecl, module, fa, fa2, *listpr, *listep, *vecinvpi, *vectau; GEN pr, t, EX, sarch, cyc, F; long i,j,l,lp; /* basecl = generators in factored form */ basecl = compute_fact(nf,u1,gen); module = (GEN)bid[1]; cyc = gmael(bid,2,2); EX = (GEN)cyc[1]; /* exponent of (O/f)^* */ f = (GEN)module[1]; fZ = gcoeff(f,1,1); fa = (GEN)bid[3]; fa2 = (GEN)bid[4]; sarch = (GEN)fa2[lg(fa2)-1]; listpr = (GEN*)fa[1]; F = init_unif_mod_fZ((GEN)listpr); listep = (GEN*)fa[2]; lp = lg(listpr); vecinvpi = (GEN*)cgetg(lp, t_VEC); vectau = (GEN*)cgetg(lp, t_VEC); for (i=1; i<lp; i++) { pr = listpr[i]; vecinvpi[i] = NULL; /* to be computed if needed */ vectau[i] = eltmul_get_table(nf, (GEN)pr[5]); } l = lg(basecl); for (i=1; i<l; i++) { GEN invpi, dmulI, mulI, G, I, A, e, L, newL; long la, v, k; /* G = [I, A=famat(L,e)] is a generator, I integral */ G = (GEN)basecl[i]; I = (GEN)G[1]; A = (GEN)G[2]; L = (GEN)A[1]; e = (GEN)A[2]; /* if no reduction took place in compute_fact, everybody is still coprime * to f + no denominators */ if (!I) { basecl[i] = (long)famat_to_nf_modidele(nf, L, e, bid); continue; } if (lg(A) == 1) { basecl[i] = (long)I; continue; } /* compute mulI so that mulI * I coprime to f * FIXME: use idealcoprime ??? (Less efficient. Fix idealcoprime!) */ dmulI = mulI = NULL; for (j=1; j<lp; j++) { pr = listpr[j]; v = idealval(nf, I, pr); if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf, invpi, stoi(v)); mulI = mulI? element_mul(nf, mulI, t): t; t = gpowgs((GEN)pr[1], v); dmulI = dmulI? mulii(dmulI, t): t; } /* make all components of L coprime to f. * Assuming (L^e * I, f) = 1, then newL^e * mulI = L^e */ la = lg(e); newL = cgetg(la, t_VEC); for (k=1; k<la; k++) { GEN L0, cx, LL = _algtobasis(nf, (GEN)L[k]); L0 = Q_primitive_part(LL, &cx); /* LL = L0*cx (faster element_val) */ for (j=1; j<lp; j++) { pr = listpr[j]; v = fast_val(nf, L0,cx, pr,vectau[j]); /* = val_pr(LL) */ if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf,invpi,stoi(v)); LL = element_mul(nf, LL, t); LL = gdivexact(LL, gpowgs((GEN)pr[1], v)); } newL[k] = (long)FpV_red(make_integral(LL,fZ), fZ); } /* G in nf, = L^e mod f */ G = famat_to_nf_modideal_coprime(nf, newL, gmod(e,EX), f); if (mulI) { G = element_muli(nf, G, mulI); G = colreducemodHNF(G, gmul(f, dmulI), NULL); } G = set_sign_mod_idele(nf,A,G,module,sarch); I = idealmul(nf,I,G); if (dmulI) I = gdivexact(I, dmulI); /* more or less useless, but cheap at this point */ I = _idealmodidele(nf,I,module,sarch); basecl[i] = (long)I; } return basecl;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/4cd73225d697f865e8e6fd767f513c71c0cc5a79/buch3.c/buggy/src/basemath/buch3.c |
newL[k] = (long)FpV_red(make_integral(LL,fZ), fZ); | newL[k] = (long)FpV_red(make_integral(nf,LL,f,listpr), fZ); | compute_raygen(GEN nf, GEN u1, GEN gen, GEN bid){ GEN f, fZ, basecl, module, fa, fa2, *listpr, *listep, *vecinvpi, *vectau; GEN pr, t, EX, sarch, cyc, F; long i,j,l,lp; /* basecl = generators in factored form */ basecl = compute_fact(nf,u1,gen); module = (GEN)bid[1]; cyc = gmael(bid,2,2); EX = (GEN)cyc[1]; /* exponent of (O/f)^* */ f = (GEN)module[1]; fZ = gcoeff(f,1,1); fa = (GEN)bid[3]; fa2 = (GEN)bid[4]; sarch = (GEN)fa2[lg(fa2)-1]; listpr = (GEN*)fa[1]; F = init_unif_mod_fZ((GEN)listpr); listep = (GEN*)fa[2]; lp = lg(listpr); vecinvpi = (GEN*)cgetg(lp, t_VEC); vectau = (GEN*)cgetg(lp, t_VEC); for (i=1; i<lp; i++) { pr = listpr[i]; vecinvpi[i] = NULL; /* to be computed if needed */ vectau[i] = eltmul_get_table(nf, (GEN)pr[5]); } l = lg(basecl); for (i=1; i<l; i++) { GEN invpi, dmulI, mulI, G, I, A, e, L, newL; long la, v, k; /* G = [I, A=famat(L,e)] is a generator, I integral */ G = (GEN)basecl[i]; I = (GEN)G[1]; A = (GEN)G[2]; L = (GEN)A[1]; e = (GEN)A[2]; /* if no reduction took place in compute_fact, everybody is still coprime * to f + no denominators */ if (!I) { basecl[i] = (long)famat_to_nf_modidele(nf, L, e, bid); continue; } if (lg(A) == 1) { basecl[i] = (long)I; continue; } /* compute mulI so that mulI * I coprime to f * FIXME: use idealcoprime ??? (Less efficient. Fix idealcoprime!) */ dmulI = mulI = NULL; for (j=1; j<lp; j++) { pr = listpr[j]; v = idealval(nf, I, pr); if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf, invpi, stoi(v)); mulI = mulI? element_mul(nf, mulI, t): t; t = gpowgs((GEN)pr[1], v); dmulI = dmulI? mulii(dmulI, t): t; } /* make all components of L coprime to f. * Assuming (L^e * I, f) = 1, then newL^e * mulI = L^e */ la = lg(e); newL = cgetg(la, t_VEC); for (k=1; k<la; k++) { GEN L0, cx, LL = _algtobasis(nf, (GEN)L[k]); L0 = Q_primitive_part(LL, &cx); /* LL = L0*cx (faster element_val) */ for (j=1; j<lp; j++) { pr = listpr[j]; v = fast_val(nf, L0,cx, pr,vectau[j]); /* = val_pr(LL) */ if (!v) continue; invpi = get_invpi(nf, fZ, pr, F, &vecinvpi[j]); t = element_pow(nf,invpi,stoi(v)); LL = element_mul(nf, LL, t); LL = gdivexact(LL, gpowgs((GEN)pr[1], v)); } newL[k] = (long)FpV_red(make_integral(LL,fZ), fZ); } /* G in nf, = L^e mod f */ G = famat_to_nf_modideal_coprime(nf, newL, gmod(e,EX), f); if (mulI) { G = element_muli(nf, G, mulI); G = colreducemodHNF(G, gmul(f, dmulI), NULL); } G = set_sign_mod_idele(nf,A,G,module,sarch); I = idealmul(nf,I,G); if (dmulI) I = gdivexact(I, dmulI); /* more or less useless, but cheap at this point */ I = _idealmodidele(nf,I,module,sarch); basecl[i] = (long)I; } return basecl;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/4cd73225d697f865e8e6fd767f513c71c0cc5a79/buch3.c/buggy/src/basemath/buch3.c |
unsigned int sr; | unsigned int sr, srbits; /* ** mask off the int level bits only so we can ** preserve software int settings and FP enable ** for this thread. Note we don't force software ints ** enabled when changing level, they were turned on ** when this task was created, but may have been turned ** off since, so we'll just leave them alone. */ | void _CPU_ISR_Set_level( unsigned32 new_level ){ unsigned int sr; mips_get_sr(sr);#if __mips == 3 if ( (new_level & SR_EXL) == (sr & SR_EXL) ) return; if ( (new_level & SR_EXL) == 0 ) { sr &= ~SR_EXL; /* clear the EXL bit */ mips_set_sr(sr); } else { sr &= ~SR_IE; mips_set_sr(sr); /* first disable ie bit (recommended) */ sr |= SR_EXL|SR_IE; /* enable exception level */ mips_set_sr(sr); /* first disable ie bit (recommended) */ } #elif __mips == 1 if ( (new_level & SR_IEC) == (sr & SR_IEC) ) return; sr &= ~SR_IEC; /* clear the IEC bit */ if ( !new_level ) sr |= SR_IEC; /* enable interrupts */ mips_set_sr(sr);#else#error "CPU ISR level: unknown MIPS level for SR handling"#endif} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/e6dec71c2703bd6b54e957746931b532d2fb44fa/cpu.c/buggy/c/src/exec/score/cpu/mips/cpu.c |
sr &= ~SR_EXL; /* clear the EXL bit */ | sr &= ~SR_EXL; * clear the EXL bit * | void _CPU_ISR_Set_level( unsigned32 new_level ){ unsigned int sr; mips_get_sr(sr);#if __mips == 3 if ( (new_level & SR_EXL) == (sr & SR_EXL) ) return; if ( (new_level & SR_EXL) == 0 ) { sr &= ~SR_EXL; /* clear the EXL bit */ mips_set_sr(sr); } else { sr &= ~SR_IE; mips_set_sr(sr); /* first disable ie bit (recommended) */ sr |= SR_EXL|SR_IE; /* enable exception level */ mips_set_sr(sr); /* first disable ie bit (recommended) */ } #elif __mips == 1 if ( (new_level & SR_IEC) == (sr & SR_IEC) ) return; sr &= ~SR_IEC; /* clear the IEC bit */ if ( !new_level ) sr |= SR_IEC; /* enable interrupts */ mips_set_sr(sr);#else#error "CPU ISR level: unknown MIPS level for SR handling"#endif} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/e6dec71c2703bd6b54e957746931b532d2fb44fa/cpu.c/buggy/c/src/exec/score/cpu/mips/cpu.c |
sr &= ~SR_IE; mips_set_sr(sr); /* first disable ie bit (recommended) */ | void _CPU_ISR_Set_level( unsigned32 new_level ){ unsigned int sr; mips_get_sr(sr);#if __mips == 3 if ( (new_level & SR_EXL) == (sr & SR_EXL) ) return; if ( (new_level & SR_EXL) == 0 ) { sr &= ~SR_EXL; /* clear the EXL bit */ mips_set_sr(sr); } else { sr &= ~SR_IE; mips_set_sr(sr); /* first disable ie bit (recommended) */ sr |= SR_EXL|SR_IE; /* enable exception level */ mips_set_sr(sr); /* first disable ie bit (recommended) */ } #elif __mips == 1 if ( (new_level & SR_IEC) == (sr & SR_IEC) ) return; sr &= ~SR_IEC; /* clear the IEC bit */ if ( !new_level ) sr |= SR_IEC; /* enable interrupts */ mips_set_sr(sr);#else#error "CPU ISR level: unknown MIPS level for SR handling"#endif} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/e6dec71c2703bd6b54e957746931b532d2fb44fa/cpu.c/buggy/c/src/exec/score/cpu/mips/cpu.c |
|
sr |= SR_EXL|SR_IE; /* enable exception level */ mips_set_sr(sr); /* first disable ie bit (recommended) */ | sr |= SR_EXL|SR_IE; * enable exception level * mips_set_sr(sr); * first disable ie bit (recommended) * | void _CPU_ISR_Set_level( unsigned32 new_level ){ unsigned int sr; mips_get_sr(sr);#if __mips == 3 if ( (new_level & SR_EXL) == (sr & SR_EXL) ) return; if ( (new_level & SR_EXL) == 0 ) { sr &= ~SR_EXL; /* clear the EXL bit */ mips_set_sr(sr); } else { sr &= ~SR_IE; mips_set_sr(sr); /* first disable ie bit (recommended) */ sr |= SR_EXL|SR_IE; /* enable exception level */ mips_set_sr(sr); /* first disable ie bit (recommended) */ } #elif __mips == 1 if ( (new_level & SR_IEC) == (sr & SR_IEC) ) return; sr &= ~SR_IEC; /* clear the IEC bit */ if ( !new_level ) sr |= SR_IEC; /* enable interrupts */ mips_set_sr(sr);#else#error "CPU ISR level: unknown MIPS level for SR handling"#endif} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/e6dec71c2703bd6b54e957746931b532d2fb44fa/cpu.c/buggy/c/src/exec/score/cpu/mips/cpu.c |
if ( (new_level & SR_IEC) == (sr & SR_IEC) ) return; | mips_set_sr( (sr & ~SR_IEC) ); | void _CPU_ISR_Set_level( unsigned32 new_level ){ unsigned int sr; mips_get_sr(sr);#if __mips == 3 if ( (new_level & SR_EXL) == (sr & SR_EXL) ) return; if ( (new_level & SR_EXL) == 0 ) { sr &= ~SR_EXL; /* clear the EXL bit */ mips_set_sr(sr); } else { sr &= ~SR_IE; mips_set_sr(sr); /* first disable ie bit (recommended) */ sr |= SR_EXL|SR_IE; /* enable exception level */ mips_set_sr(sr); /* first disable ie bit (recommended) */ } #elif __mips == 1 if ( (new_level & SR_IEC) == (sr & SR_IEC) ) return; sr &= ~SR_IEC; /* clear the IEC bit */ if ( !new_level ) sr |= SR_IEC; /* enable interrupts */ mips_set_sr(sr);#else#error "CPU ISR level: unknown MIPS level for SR handling"#endif} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/e6dec71c2703bd6b54e957746931b532d2fb44fa/cpu.c/buggy/c/src/exec/score/cpu/mips/cpu.c |
sr &= ~SR_IEC; /* clear the IEC bit */ if ( !new_level ) sr |= SR_IEC; /* enable interrupts */ mips_set_sr(sr); | srbits = sr & ~(0xfc00 | SR_IEC); sr = srbits | ((new_level==0)?0xfc01:( ((new_level<<9) & 0xfc000) | (new_level & 1))); | void _CPU_ISR_Set_level( unsigned32 new_level ){ unsigned int sr; mips_get_sr(sr);#if __mips == 3 if ( (new_level & SR_EXL) == (sr & SR_EXL) ) return; if ( (new_level & SR_EXL) == 0 ) { sr &= ~SR_EXL; /* clear the EXL bit */ mips_set_sr(sr); } else { sr &= ~SR_IE; mips_set_sr(sr); /* first disable ie bit (recommended) */ sr |= SR_EXL|SR_IE; /* enable exception level */ mips_set_sr(sr); /* first disable ie bit (recommended) */ } #elif __mips == 1 if ( (new_level & SR_IEC) == (sr & SR_IEC) ) return; sr &= ~SR_IEC; /* clear the IEC bit */ if ( !new_level ) sr |= SR_IEC; /* enable interrupts */ mips_set_sr(sr);#else#error "CPU ISR level: unknown MIPS level for SR handling"#endif} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/e6dec71c2703bd6b54e957746931b532d2fb44fa/cpu.c/buggy/c/src/exec/score/cpu/mips/cpu.c |
mips_set_sr( sr ); | void _CPU_ISR_Set_level( unsigned32 new_level ){ unsigned int sr; mips_get_sr(sr);#if __mips == 3 if ( (new_level & SR_EXL) == (sr & SR_EXL) ) return; if ( (new_level & SR_EXL) == 0 ) { sr &= ~SR_EXL; /* clear the EXL bit */ mips_set_sr(sr); } else { sr &= ~SR_IE; mips_set_sr(sr); /* first disable ie bit (recommended) */ sr |= SR_EXL|SR_IE; /* enable exception level */ mips_set_sr(sr); /* first disable ie bit (recommended) */ } #elif __mips == 1 if ( (new_level & SR_IEC) == (sr & SR_IEC) ) return; sr &= ~SR_IEC; /* clear the IEC bit */ if ( !new_level ) sr |= SR_IEC; /* enable interrupts */ mips_set_sr(sr);#else#error "CPU ISR level: unknown MIPS level for SR handling"#endif} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/e6dec71c2703bd6b54e957746931b532d2fb44fa/cpu.c/buggy/c/src/exec/score/cpu/mips/cpu.c |
|
mulred(GEN nf,GEN x, GEN I, long prec,long precint) | mulred(GEN nf,GEN x, GEN I, long prec) | mulred(GEN nf,GEN x, GEN I, long prec,long precint){ long av = avma; GEN y = cgetg(3,t_VEC); y[1] = (long)idealmulh(nf,I,(GEN)x[1]); y[2] = x[2]; y = ideallllredall(nf,y,NULL,prec,precint); y[1] = (long)ideal_two_elt(nf,(GEN)y[1]); return gerepileupto(av,gcopy(y));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/df4471290da20ed117d7634b848dd9a8940d48d1/buch2.c/clean/src/basemath/buch2.c |
y = ideallllredall(nf,y,NULL,prec,precint); | y = ideallllred(nf,y,NULL,prec); | mulred(GEN nf,GEN x, GEN I, long prec,long precint){ long av = avma; GEN y = cgetg(3,t_VEC); y[1] = (long)idealmulh(nf,I,(GEN)x[1]); y[2] = x[2]; y = ideallllredall(nf,y,NULL,prec,precint); y[1] = (long)ideal_two_elt(nf,(GEN)y[1]); return gerepileupto(av,gcopy(y));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/df4471290da20ed117d7634b848dd9a8940d48d1/buch2.c/clean/src/basemath/buch2.c |
if ((last->inp_socket->so_options&(SO_REUSEPORT|SO_REUSEADDR) == 0)) | if (((last->inp_socket->so_options&(SO_REUSEPORT|SO_REUSEADDR)) == 0)) | udp_input(m, iphlen) register struct mbuf *m; int iphlen;{ register struct ip *ip; register struct udphdr *uh; register struct inpcb *inp; struct mbuf *opts = 0; int len; struct ip save_ip; udpstat.udps_ipackets++; /* * Strip IP options, if any; should skip this, * make available to user, and use on returned packets, * but we don't yet have a way to check the checksum * with options still present. */ if (iphlen > sizeof (struct ip)) { ip_stripoptions(m, (struct mbuf *)0); iphlen = sizeof(struct ip); } /* * Get IP and UDP header together in first mbuf. */ ip = mtod(m, struct ip *); if (m->m_len < iphlen + sizeof(struct udphdr)) { if ((m = m_pullup(m, iphlen + sizeof(struct udphdr))) == 0) { udpstat.udps_hdrops++; return; } ip = mtod(m, struct ip *); } uh = (struct udphdr *)((caddr_t)ip + iphlen); /* * Make mbuf data length reflect UDP length. * If not enough data to reflect UDP length, drop. */ len = ntohs((u_short)uh->uh_ulen); if (ip->ip_len != len) { if (len > ip->ip_len || len < sizeof(struct udphdr)) { udpstat.udps_badlen++; goto bad; } m_adj(m, len - ip->ip_len); /* ip->ip_len = len; */ } /* * Save a copy of the IP header in case we want restore it * for sending an ICMP error message in response. */ save_ip = *ip; /* * Checksum extended UDP header and data. */ if (uh->uh_sum) { ((struct ipovly *)ip)->ih_next = 0; ((struct ipovly *)ip)->ih_prev = 0; ((struct ipovly *)ip)->ih_x1 = 0; ((struct ipovly *)ip)->ih_len = uh->uh_ulen; uh->uh_sum = in_cksum(m, len + sizeof (struct ip)); if (uh->uh_sum) { udpstat.udps_badsum++; m_freem(m); return; } } if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) || in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif)) { struct inpcb *last; /* * Deliver a multicast or broadcast datagram to *all* sockets * for which the local and remote addresses and ports match * those of the incoming datagram. This allows more than * one process to receive multi/broadcasts on the same port. * (This really ought to be done for unicast datagrams as * well, but that would cause problems with existing * applications that open both address-specific sockets and * a wildcard socket listening to the same port -- they would * end up receiving duplicates of every unicast datagram. * Those applications open the multiple sockets to overcome an * inadequacy of the UDP socket interface, but for backwards * compatibility we avoid the problem here rather than * fixing the interface. Maybe 4.5BSD will remedy this?) */ /* * Construct sockaddr format source address. */ udp_in.sin_port = uh->uh_sport; udp_in.sin_addr = ip->ip_src; m->m_len -= sizeof (struct udpiphdr); m->m_data += sizeof (struct udpiphdr); /* * Locate pcb(s) for datagram. * (Algorithm copied from raw_intr().) */ last = NULL; for (inp = udb.lh_first; inp != NULL; inp = inp->inp_list.le_next) { if (inp->inp_lport != uh->uh_dport) continue; if (inp->inp_laddr.s_addr != INADDR_ANY) { if (inp->inp_laddr.s_addr != ip->ip_dst.s_addr) continue; } if (inp->inp_faddr.s_addr != INADDR_ANY) { if (inp->inp_faddr.s_addr != ip->ip_src.s_addr || inp->inp_fport != uh->uh_sport) continue; } if (last != NULL) { struct mbuf *n; if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { if (last->inp_flags & INP_CONTROLOPTS || last->inp_socket->so_options & SO_TIMESTAMP) ip_savecontrol(last, &opts, ip, n); if (sbappendaddr(&last->inp_socket->so_rcv, (struct sockaddr *)&udp_in, n, opts) == 0) { m_freem(n); if (opts) m_freem(opts); udpstat.udps_fullsock++; } else sorwakeup(last->inp_socket); opts = 0; } } last = inp; /* * Don't look for additional matches if this one does * not have either the SO_REUSEPORT or SO_REUSEADDR * socket options set. This heuristic avoids searching * through all pcbs in the common case of a non-shared * port. It * assumes that an application will never * clear these options after setting them. */ if ((last->inp_socket->so_options&(SO_REUSEPORT|SO_REUSEADDR) == 0)) break; } if (last == NULL) { /* * No matching pcb found; discard datagram. * (No need to send an ICMP Port Unreachable * for a broadcast or multicast datgram.) */ udpstat.udps_noportbcast++; goto bad; } if (last->inp_flags & INP_CONTROLOPTS || last->inp_socket->so_options & SO_TIMESTAMP) ip_savecontrol(last, &opts, ip, m); if (sbappendaddr(&last->inp_socket->so_rcv, (struct sockaddr *)&udp_in, m, opts) == 0) { udpstat.udps_fullsock++; goto bad; } sorwakeup(last->inp_socket); return; } /* * Locate pcb for datagram. */ inp = in_pcblookuphash(&udbinfo, ip->ip_src, uh->uh_sport, ip->ip_dst, uh->uh_dport, 1); if (inp == NULL) { if (log_in_vain) { char buf[4*sizeof "123"]; strcpy(buf, inet_ntoa(ip->ip_dst)); log(LOG_INFO, "Connection attempt to UDP %s:%d" " from %s:%d\n", buf, ntohs(uh->uh_dport), inet_ntoa(ip->ip_src), ntohs(uh->uh_sport)); } udpstat.udps_noport++; if (m->m_flags & (M_BCAST | M_MCAST)) { udpstat.udps_noportbcast++; goto bad; } *ip = save_ip; icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_PORT, 0, 0); return; } /* * Construct sockaddr format source address. * Stuff source address and datagram in user buffer. */ udp_in.sin_port = uh->uh_sport; udp_in.sin_addr = ip->ip_src; if (inp->inp_flags & INP_CONTROLOPTS || inp->inp_socket->so_options & SO_TIMESTAMP) ip_savecontrol(inp, &opts, ip, m); iphlen += sizeof(struct udphdr); m->m_len -= iphlen; m->m_pkthdr.len -= iphlen; m->m_data += iphlen; if (sbappendaddr(&inp->inp_socket->so_rcv, (struct sockaddr *)&udp_in, m, opts) == 0) { udpstat.udps_fullsock++; goto bad; } sorwakeup(inp->inp_socket); return;bad: m_freem(m); if (opts) m_freem(opts);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/udp_usrreq.c/clean/c/src/lib/libnetworking/netinet/udp_usrreq.c |
if (err_catch_stack) { | if (err_catch_stack && numerr != memer) { /* can't trap memer --> infinite recursion if we need a temp buffer */ | err(long numerr, ...){ char s[128], *ch1; int ret = 0, trap = 0; PariOUT *out = pariOut; va_list ap; va_start(ap,numerr); if (err_catch_stack) { if (err_catch_stack[numerr]) trap = numerr; else if (err_catch_stack[noer] && numerr >= talker) trap = noer; } if (trap) { /* all non-syntax errors (noer), or numerr individually trapped */ cell *a = (cell*) err_catch_stack[trap]->value; global_err_data = a->data; if (a->env) longjmp(a->env, numerr); } else global_err_data = NULL; if (!added_newline) { pariputc('\n'); added_newline=1; } pariflush(); pariOut = pariErr; pariflush(); term_color(c_ERR); if (numerr < talker) { strcpy(s, errmessage[numerr]); switch (numerr) { case obsoler: ch1 = va_arg(ap,char *); errcontext(s,ch1,va_arg(ap,char *)); if (whatnow_fun) { term_color(c_NONE); print_text("For full compatibility with GP 1.39, type \"default(compatible,3)\" (you can also set \"compatible = 3\" in your GPRC file)"); pariputc('\n'); ch1 = va_arg(ap,char *); whatnow_fun(ch1, - va_arg(ap,int)); } break; case openfiler: sprintf(s+strlen(s), "%s file", va_arg(ap,char*)); ch1 = va_arg(ap,char *); errcontext(s,ch1,ch1); break; case talker2: case member: strcat(s,va_arg(ap, char*)); /* fall through */ default: ch1 = va_arg(ap,char *); errcontext(s,ch1,va_arg(ap,char *)); } } else { pariputsf(" *** %s", errmessage[numerr]); switch (numerr) { case talker: case siginter: ch1=va_arg(ap, char*); vpariputs(ch1,ap); pariputc('.'); break; case impl: ch1=va_arg(ap, char*); pariputsf(" %s is not yet implemented.",ch1); break; case breaker: case typeer: case mattype1: case overwriter: case accurer: case infprecer: case negexper: case polrationer: case funder2: case constpoler: case notpoler: case redpoler: case zeropoler: case consister: case flagerr: pariputsf(" in %s.",va_arg(ap, char*)); break; case bugparier: pariputsf(" %s, please report",va_arg(ap, char*)); break; case operi: case operf: { char *f, *op = va_arg(ap, char*); long x = va_arg(ap, long); long y = va_arg(ap, long); if (*op == '+') f = "addition"; else if (*op == '*') f = "multiplication"; else if (*op == '/' || *op == '%') f = "division"; else if (*op == 'g') { op = ","; f = "gcd"; } else { op = "-->"; f = "assignment"; } pariputsf(" %s %s %s %s.",f,type_name(x),op,type_name(y)); break; } /* the following 4 are only warnings (they return) */ case warnmem: case warner: pariputc(' '); ch1=va_arg(ap, char*); vpariputs(ch1,ap); pariputs(".\n"); ret = 1; break; case warnprec: vpariputs(" in %s; new prec = %ld\n",ap); ret = 1; break; case warnfile: ch1=va_arg(ap, char*); pariputsf(" %s: %s", ch1, va_arg(ap, char*)); ret = 1; break; } } term_color(c_NONE); va_end(ap); if (numerr==errpile) { fprintferr("\n current stack size: %.1f Mbytes\n", (double)(top-bot)/1E6); fprintferr(" [hint] you can increase GP stack with allocatemem()\n"); } pariOut = out; if (ret || (trap && default_exception_handler && default_exception_handler(numerr))) { flusherr(); return; } err_recover(numerr); exit(1); /* not reached */} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a76a4ccb8a31c0392cb71d7bb1a6b03622953ac3/init.c/clean/src/language/init.c |
while (isdigit(*cp)) | while (isdigit((int)*cp)) | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
while (isspace(*cp)) | while (isspace((int)*cp)) | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
if (!(isdigit(*cp))) | if (!(isdigit((int)*cp))) | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
while (isdigit(*cp)) | while (isdigit((int)*cp)) | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
while (isspace(*cp)) | while (isspace((int)*cp)) | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
if (!(isdigit(*cp))) | if (!(isdigit((int)*cp))) | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
while (isdigit(*cp)) | while (isdigit((int)*cp)) | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
if (isdigit(*cp)) { | if (isdigit((int)*cp)) { | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
if (isdigit(*cp)) { | if (isdigit((int)*cp)) { | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
if (isdigit(*cp)) { | if (isdigit((int)*cp)) { | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
while (!isspace(*cp)) /* if any trailing garbage */ | while (!isspace((int)*cp)) /* if any trailing garbage */ | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
while (isspace(*cp)) | while (isspace((int)*cp)) | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
while (!isspace(*cp)) /* if any trailing garbage */ | while (!isspace((int)*cp)) /* if any trailing garbage */ | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
while (isspace(*cp)) /* move to next field */ | while (isspace((int)*cp)) /* move to next field */ | latlon2ul(latlonstrptr,which) char **latlonstrptr; int *which;{ char *cp; u_int32_t retval; int deg = 0, min = 0, secs = 0, secsfrac = 0; cp = *latlonstrptr; while (isdigit(*cp)) deg = deg * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) min = min * 10 + (*cp++ - '0'); while (isspace(*cp)) cp++; if (!(isdigit(*cp))) goto fndhemi; while (isdigit(*cp)) secs = secs * 10 + (*cp++ - '0'); if (*cp == '.') { /* decimal seconds */ cp++; if (isdigit(*cp)) { secsfrac = (*cp++ - '0') * 100; if (isdigit(*cp)) { secsfrac += (*cp++ - '0') * 10; if (isdigit(*cp)) { secsfrac += (*cp++ - '0'); } } } } while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) cp++; fndhemi: switch (*cp) { case 'N': case 'n': case 'E': case 'e': retval = ((unsigned)1<<31) + (((((deg * 60) + min) * 60) + secs) * 1000) + secsfrac; break; case 'S': case 's': case 'W': case 'w': retval = ((unsigned)1<<31) - (((((deg * 60) + min) * 60) + secs) * 1000) - secsfrac; break; default: retval = 0; /* invalid value -- indicates error */ break; } switch (*cp) { case 'N': case 'n': case 'S': case 's': *which = 1; /* latitude */ break; case 'E': case 'e': case 'W': case 'w': *which = 2; /* longitude */ break; default: *which = 0; /* error */ break; } cp++; /* skip the hemisphere */ while (!isspace(*cp)) /* if any trailing garbage */ cp++; while (isspace(*cp)) /* move to next field */ cp++; *latlonstrptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/lib/libnetworking/libc/res_debug.c |
red_cyclo2n_ip(GEN x, int n) | red_cyclo2n_ip(GEN x, long n) | red_cyclo2n_ip(GEN x, int n){ long i, pow2 = 1<<(n-1); for (i = lg(x)-1; i>pow2+1; i--) if (signe(x[i])) x[i-pow2] = lsubii((GEN)x[i-pow2], (GEN)x[i]); return normalizepol_i(x, i+1);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b03001ef86c74799b6280212f7a40aee0823ed89/aprcl.c/clean/src/modules/aprcl.c |
red_cyclo2n(GEN x, int n) { return red_cyclo2n_ip(dummycopy(x), n); } | red_cyclo2n(GEN x, long n) { return red_cyclo2n_ip(dummycopy(x), n); } | red_cyclo2n(GEN x, int n) { return red_cyclo2n_ip(dummycopy(x), n); } | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b03001ef86c74799b6280212f7a40aee0823ed89/aprcl.c/clean/src/modules/aprcl.c |
autvec_AL(int pk, GEN z, GEN v, Red *R) | autvec_AL(long pk, GEN z, GEN v, Red *R) | autvec_AL(int pk, GEN z, GEN v, Red *R){ const int r = umodiu(R->N, pk); GEN s = polun[varn(R->C)]; int i, lv = lg(v); for (i=1; i<lv; i++) { long y = (r*v[i]) / pk; if (y) s = RgXQ_mul(s, RgXQ_u_pow(aut(pk,z, v[i]), y, R->C), R->C); } return s;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b03001ef86c74799b6280212f7a40aee0823ed89/aprcl.c/clean/src/modules/aprcl.c |
const int r = umodiu(R->N, pk); | const long r = umodiu(R->N, pk); | autvec_AL(int pk, GEN z, GEN v, Red *R){ const int r = umodiu(R->N, pk); GEN s = polun[varn(R->C)]; int i, lv = lg(v); for (i=1; i<lv; i++) { long y = (r*v[i]) / pk; if (y) s = RgXQ_mul(s, RgXQ_u_pow(aut(pk,z, v[i]), y, R->C), R->C); } return s;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b03001ef86c74799b6280212f7a40aee0823ed89/aprcl.c/clean/src/modules/aprcl.c |
int i, lv = lg(v); | long i, lv = lg(v); | autvec_AL(int pk, GEN z, GEN v, Red *R){ const int r = umodiu(R->N, pk); GEN s = polun[varn(R->C)]; int i, lv = lg(v); for (i=1; i<lv; i++) { long y = (r*v[i]) / pk; if (y) s = RgXQ_mul(s, RgXQ_u_pow(aut(pk,z, v[i]), y, R->C), R->C); } return s;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b03001ef86c74799b6280212f7a40aee0823ed89/aprcl.c/clean/src/modules/aprcl.c |
printf ("Can't create syslog seamphore: %d\n", sc); | printf ("Can't create syslog semaphore: %d\n", sc); | openlog (const char *ident, int logstat, int logfac){ rtems_status_code sc; struct sockaddr_in myAddress; if (ident != NULL) LogTag = ident; LogStatus = logstat; if (logfac != 0 && (logfac & ~LOG_FACMASK) == 0) LogFacility = logfac; /* * Create the socket */ if ((LogFd = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { printf ("Can't create syslog socket: %d\n", errno); return; } /* * Bind socket to name */ myAddress.sin_family = AF_INET; myAddress.sin_addr.s_addr = INADDR_ANY; myAddress.sin_port = 0; memset (myAddress.sin_zero, '\0', sizeof myAddress.sin_zero); if (bind (LogFd, (struct sockaddr *)&myAddress, sizeof (myAddress)) < 0) { close (LogFd); LogFd = -1; printf ("Can't bind syslog socket: %d\n", errno); return; } /* * Create the mutex */ sc = rtems_semaphore_create (rtems_build_name('s', 'L', 'o', 'g'), 1, RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL, 0, &LogSemaphore); if (sc != RTEMS_SUCCESSFUL) { printf ("Can't create syslog seamphore: %d\n", sc); close (LogFd); LogFd = -1; }} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/4b35e0e24e4cc17d513323c9375055325164b6f1/syslog.c/clean/cpukit/libnetworking/lib/syslog.c |
if (l[i+1].nb) { xsml = xbig = l[i ].d[0]; ysml = ybig = l[i+1].d[0]; break; } | if (l[i+1].nb) break; | gtodblList(GEN data, long flags){ dblPointList *l; double xsml,xbig,ysml,ybig; long tx=typ(data), ty, nl=lg(data)-1, lx1,lx; register long i,j,u,v; long param=(flags & PLOT_PARAMETRIC); GEN x,y; if (! is_vec_t(tx)) err(talker,"not a vector in gtodblList"); if (!nl) return NULL; lx1 = lg(data[1]); if (nl == 1) err(talker,"single vector in gtodblList"); /* Allocate memory, then convert coord. to double */ l = (dblPointList*) gpmalloc(nl*sizeof(dblPointList)); for (i=0; i<nl-1; i+=2) { u = i+1; x = (GEN)data[u]; tx = typ(x); y = (GEN)data[u+1]; ty = typ(y); if (!is_vec_t(tx) || !is_vec_t(ty)) err(ploter4); lx = lg(x); if (lg(y) != lx) err(ploter5); if (!param && lx != lx1) err(ploter5); lx--; l[i].d = (double*) gpmalloc(lx*sizeof(double)); l[u].d = (double*) gpmalloc(lx*sizeof(double)); for (j=0; j<lx; j=v) { v = j+1; l[i].d[j] = gtodouble((GEN)x[v]); l[u].d[j] = gtodouble((GEN)y[v]); } l[i].nb = l[u].nb = lx; } /* Now compute extremas */ if (param) { l[0].nb = nl/2; for (i=0; i < l[0].nb; i+=2) if (l[i+1].nb) { xsml = xbig = l[i ].d[0]; ysml = ybig = l[i+1].d[0]; break; } if (i >= l[0].nb) { free(l); return NULL; } for (i=0; i < l[0].nb; i+=2) { u = i+1; for (j=0; j < l[u].nb; j++) { if (l[i].d[j] < xsml) xsml = l[i].d[j]; else if (l[i].d[j] > xbig) xbig = l[i].d[j]; if (l[u].d[j] < ysml) ysml = l[u].d[j]; else if (l[u].d[j] > ybig) ybig = l[u].d[j]; } } } else { if (!l[0].nb) { free(l); return NULL; } l[0].nb = nl-1; xsml = xbig = l[0].d[0]; ysml = ybig = l[1].d[0]; for (j=0; j < l[1].nb; j++) { if (l[0].d[j] < xsml) xsml = l[0].d[j]; else if (l[0].d[j] > xbig) xbig = l[0].d[j]; } for (i=1; i <= l[0].nb; i++) for (j=0; j < l[i].nb; j++) { if (l[i].d[j] < ysml) ysml = l[i].d[j]; else if (l[i].d[j] > ybig) ybig = l[i].d[j]; } } l[0].xsml = xsml; l[0].xbig = xbig; l[0].ysml = ysml; l[0].ybig = ybig; return l;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/3d78f366d30d9d1173a4c6b2503d65ec791bfc90/plotport.c/buggy/src/graph/plotport.c |
xsml = xbig = l[i ].d[0]; ysml = ybig = l[i+1].d[0]; | gtodblList(GEN data, long flags){ dblPointList *l; double xsml,xbig,ysml,ybig; long tx=typ(data), ty, nl=lg(data)-1, lx1,lx; register long i,j,u,v; long param=(flags & PLOT_PARAMETRIC); GEN x,y; if (! is_vec_t(tx)) err(talker,"not a vector in gtodblList"); if (!nl) return NULL; lx1 = lg(data[1]); if (nl == 1) err(talker,"single vector in gtodblList"); /* Allocate memory, then convert coord. to double */ l = (dblPointList*) gpmalloc(nl*sizeof(dblPointList)); for (i=0; i<nl-1; i+=2) { u = i+1; x = (GEN)data[u]; tx = typ(x); y = (GEN)data[u+1]; ty = typ(y); if (!is_vec_t(tx) || !is_vec_t(ty)) err(ploter4); lx = lg(x); if (lg(y) != lx) err(ploter5); if (!param && lx != lx1) err(ploter5); lx--; l[i].d = (double*) gpmalloc(lx*sizeof(double)); l[u].d = (double*) gpmalloc(lx*sizeof(double)); for (j=0; j<lx; j=v) { v = j+1; l[i].d[j] = gtodouble((GEN)x[v]); l[u].d[j] = gtodouble((GEN)y[v]); } l[i].nb = l[u].nb = lx; } /* Now compute extremas */ if (param) { l[0].nb = nl/2; for (i=0; i < l[0].nb; i+=2) if (l[i+1].nb) { xsml = xbig = l[i ].d[0]; ysml = ybig = l[i+1].d[0]; break; } if (i >= l[0].nb) { free(l); return NULL; } for (i=0; i < l[0].nb; i+=2) { u = i+1; for (j=0; j < l[u].nb; j++) { if (l[i].d[j] < xsml) xsml = l[i].d[j]; else if (l[i].d[j] > xbig) xbig = l[i].d[j]; if (l[u].d[j] < ysml) ysml = l[u].d[j]; else if (l[u].d[j] > ybig) ybig = l[u].d[j]; } } } else { if (!l[0].nb) { free(l); return NULL; } l[0].nb = nl-1; xsml = xbig = l[0].d[0]; ysml = ybig = l[1].d[0]; for (j=0; j < l[1].nb; j++) { if (l[0].d[j] < xsml) xsml = l[0].d[j]; else if (l[0].d[j] > xbig) xbig = l[0].d[j]; } for (i=1; i <= l[0].nb; i++) for (j=0; j < l[i].nb; j++) { if (l[i].d[j] < ysml) ysml = l[i].d[j]; else if (l[i].d[j] > ybig) ybig = l[i].d[j]; } } l[0].xsml = xsml; l[0].xbig = xbig; l[0].ysml = ysml; l[0].ybig = ybig; return l;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/3d78f366d30d9d1173a4c6b2503d65ec791bfc90/plotport.c/buggy/src/graph/plotport.c |
|
GEN d = mppgcd(a,q); | GEN d = gcdii(a,q); | gcarreparfait(GEN x){ pari_sp av; GEN p1,a,p; long tx=typ(x),l,i,v; switch(tx) { case t_INT: return carreparfait(x)? gun: gzero; case t_REAL: return (signe(x)>=0)? gun: gzero; case t_INTMOD: { GEN b, q; long w; a = (GEN)x[2]; if (!signe(a)) return gun; av = avma; q = absi((GEN)x[1]); v = vali(q); if (v) /* > 0 */ { long dv; w = vali(a); dv = v - w; if (dv > 0) { if (w & 1) { avma = av; return gzero; } if (dv >= 2) { b = w? shifti(a,-w): a; if ((dv>=3 && mod8(b) != 1) || (dv==2 && mod4(b) != 1)) { avma = av; return gzero; } } } q = shifti(q, -v); } /* q is now odd */ i = kronecker(a,q); if (i < 0) { avma = av; return gzero; } if (i==0) { GEN d = mppgcd(a,q); p = (GEN)factor(d)[1]; l = lg(p); for (i=1; i<l; i++) { v = pvaluation(a,(GEN)p[i],&p1); w = pvaluation(q,(GEN)p[i], &q); if (v < w && (v&1 || kronecker(p1,(GEN)p[i]) == -1)) { avma = av; return gzero; } } if (kronecker(a,q) == -1) { avma = av; return gzero; } } /* kro(a,q) = 1, q odd: need to factor q */ p = (GEN)factor(q)[1]; l = lg(p) - 1; /* kro(a,q) = 1, check all p|q but the last (product formula) */ for (i=1; i<l; i++) if (kronecker(a,(GEN)p[i]) == -1) { avma = av; return gzero; } return gun; } case t_FRAC: av=avma; l=carreparfait(mulii((GEN)x[1],(GEN)x[2])); avma=av; return l? gun: gzero; case t_COMPLEX: return gun; case t_PADIC: a = (GEN)x[4]; if (!signe(a)) return gun; if (valp(x)&1) return gzero; p = (GEN)x[2]; if (!egalii(p, gdeux)) return (kronecker(a,p)== -1)? gzero: gun; v = precp(x); /* here p=2, a is odd */ if ((v>=3 && mod8(a) != 1 ) || (v==2 && mod4(a) != 1)) return gzero; return gun; case t_POL: return stoi( polcarrecomplet(x,NULL) ); case t_SER: if (!signe(x)) return gun; if (valp(x)&1) return gzero; return gcarreparfait((GEN)x[2]); case t_RFRAC: av=avma; l=itos(gcarreparfait(gmul((GEN)x[1],(GEN)x[2]))); avma=av; return stoi(l); case t_QFR: case t_QFI: return gcarreparfait((GEN)x[1]); case t_VEC: case t_COL: case t_MAT: l=lg(x); p1=cgetg(l,tx); for (i=1; i<l; i++) p1[i]=(long)gcarreparfait((GEN)x[i]); return p1; } err(typeer,"issquare"); return NULL; /* not reached */} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/2edc82b0d172402925241429eca01a236af8dd01/arith1.c/buggy/src/basemath/arith1.c |
long i, n; | long i, G; | constpi(long prec){ GEN A, B, C, tmppi; long i, n; pari_sp av, av2; if (gpi && lg(gpi) >= prec) return; av = avma; tmppi = newbloc(prec); *tmppi = evaltyp(t_REAL) | evallg(prec); /* 0.10... ~ log(2) / log( (2*Pi^4) / (Pi - (1+1/sqrt(2))^2) ) */ n = (long)ceil( log2( bit_accuracy_mul(prec, 0.10263977) ) ); if (n < 1) n = 1; prec++; A = real_1(prec); B = sqrtr_abs(real2n(1,prec)); setexpo(B, -1); /* = 1/sqrt(2) */ C = real2n(-2, prec); av2 = avma; for (i = 0; i < n; i++) { GEN y = A, a,b; a = addrr(A,B); setexpo(a, expo(a)-1); b = sqrtr_abs( mulrr(y, B) ); y = gsqr(subrr(a,y)); setexpo(y, expo(y) + i); affrr(subrr(C, y), C); affrr(a, A); affrr(b, B); avma = av2; } setexpo(C, expo(C)+2); affrr(divrr(gsqr(addrr(A,B)), C), tmppi); if (gpi) gunclone(gpi); avma = av; gpi = tmppi;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/1b73c9fdd5eaa36acef9431de476e239ce24347d/trans1.c/clean/src/basemath/trans1.c |
/* 0.10... ~ log(2) / log( (2*Pi^4) / (Pi - (1+1/sqrt(2))^2) ) */ n = (long)ceil( log2( bit_accuracy_mul(prec, 0.10263977) ) ); if (n < 1) n = 1; | G = - bit_accuracy(prec); | constpi(long prec){ GEN A, B, C, tmppi; long i, n; pari_sp av, av2; if (gpi && lg(gpi) >= prec) return; av = avma; tmppi = newbloc(prec); *tmppi = evaltyp(t_REAL) | evallg(prec); /* 0.10... ~ log(2) / log( (2*Pi^4) / (Pi - (1+1/sqrt(2))^2) ) */ n = (long)ceil( log2( bit_accuracy_mul(prec, 0.10263977) ) ); if (n < 1) n = 1; prec++; A = real_1(prec); B = sqrtr_abs(real2n(1,prec)); setexpo(B, -1); /* = 1/sqrt(2) */ C = real2n(-2, prec); av2 = avma; for (i = 0; i < n; i++) { GEN y = A, a,b; a = addrr(A,B); setexpo(a, expo(a)-1); b = sqrtr_abs( mulrr(y, B) ); y = gsqr(subrr(a,y)); setexpo(y, expo(y) + i); affrr(subrr(C, y), C); affrr(a, A); affrr(b, B); avma = av2; } setexpo(C, expo(C)+2); affrr(divrr(gsqr(addrr(A,B)), C), tmppi); if (gpi) gunclone(gpi); avma = av; gpi = tmppi;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/1b73c9fdd5eaa36acef9431de476e239ce24347d/trans1.c/clean/src/basemath/trans1.c |
for (i = 0; i < n; i++) | for (i = 0;; i++) | constpi(long prec){ GEN A, B, C, tmppi; long i, n; pari_sp av, av2; if (gpi && lg(gpi) >= prec) return; av = avma; tmppi = newbloc(prec); *tmppi = evaltyp(t_REAL) | evallg(prec); /* 0.10... ~ log(2) / log( (2*Pi^4) / (Pi - (1+1/sqrt(2))^2) ) */ n = (long)ceil( log2( bit_accuracy_mul(prec, 0.10263977) ) ); if (n < 1) n = 1; prec++; A = real_1(prec); B = sqrtr_abs(real2n(1,prec)); setexpo(B, -1); /* = 1/sqrt(2) */ C = real2n(-2, prec); av2 = avma; for (i = 0; i < n; i++) { GEN y = A, a,b; a = addrr(A,B); setexpo(a, expo(a)-1); b = sqrtr_abs( mulrr(y, B) ); y = gsqr(subrr(a,y)); setexpo(y, expo(y) + i); affrr(subrr(C, y), C); affrr(a, A); affrr(b, B); avma = av2; } setexpo(C, expo(C)+2); affrr(divrr(gsqr(addrr(A,B)), C), tmppi); if (gpi) gunclone(gpi); avma = av; gpi = tmppi;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/1b73c9fdd5eaa36acef9431de476e239ce24347d/trans1.c/clean/src/basemath/trans1.c |
GEN y = A, a,b; | GEN y, a, b, B_A = subrr(B, A); if (expo(B_A) < G) break; | constpi(long prec){ GEN A, B, C, tmppi; long i, n; pari_sp av, av2; if (gpi && lg(gpi) >= prec) return; av = avma; tmppi = newbloc(prec); *tmppi = evaltyp(t_REAL) | evallg(prec); /* 0.10... ~ log(2) / log( (2*Pi^4) / (Pi - (1+1/sqrt(2))^2) ) */ n = (long)ceil( log2( bit_accuracy_mul(prec, 0.10263977) ) ); if (n < 1) n = 1; prec++; A = real_1(prec); B = sqrtr_abs(real2n(1,prec)); setexpo(B, -1); /* = 1/sqrt(2) */ C = real2n(-2, prec); av2 = avma; for (i = 0; i < n; i++) { GEN y = A, a,b; a = addrr(A,B); setexpo(a, expo(a)-1); b = sqrtr_abs( mulrr(y, B) ); y = gsqr(subrr(a,y)); setexpo(y, expo(y) + i); affrr(subrr(C, y), C); affrr(a, A); affrr(b, B); avma = av2; } setexpo(C, expo(C)+2); affrr(divrr(gsqr(addrr(A,B)), C), tmppi); if (gpi) gunclone(gpi); avma = av; gpi = tmppi;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/1b73c9fdd5eaa36acef9431de476e239ce24347d/trans1.c/clean/src/basemath/trans1.c |
b = sqrtr_abs( mulrr(y, B) ); y = gsqr(subrr(a,y)); setexpo(y, expo(y) + i); | b = sqrtr_abs( mulrr(A, B) ); y = gsqr(B_A); setexpo(y, expo(y) + i - 2); | constpi(long prec){ GEN A, B, C, tmppi; long i, n; pari_sp av, av2; if (gpi && lg(gpi) >= prec) return; av = avma; tmppi = newbloc(prec); *tmppi = evaltyp(t_REAL) | evallg(prec); /* 0.10... ~ log(2) / log( (2*Pi^4) / (Pi - (1+1/sqrt(2))^2) ) */ n = (long)ceil( log2( bit_accuracy_mul(prec, 0.10263977) ) ); if (n < 1) n = 1; prec++; A = real_1(prec); B = sqrtr_abs(real2n(1,prec)); setexpo(B, -1); /* = 1/sqrt(2) */ C = real2n(-2, prec); av2 = avma; for (i = 0; i < n; i++) { GEN y = A, a,b; a = addrr(A,B); setexpo(a, expo(a)-1); b = sqrtr_abs( mulrr(y, B) ); y = gsqr(subrr(a,y)); setexpo(y, expo(y) + i); affrr(subrr(C, y), C); affrr(a, A); affrr(b, B); avma = av2; } setexpo(C, expo(C)+2); affrr(divrr(gsqr(addrr(A,B)), C), tmppi); if (gpi) gunclone(gpi); avma = av; gpi = tmppi;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/1b73c9fdd5eaa36acef9431de476e239ce24347d/trans1.c/clean/src/basemath/trans1.c |
case FIONREAD: /* Half guess that this is the right operation */ *(int *)args->buffer = tty->ccount - tty->cindex; break; | rtems_termios_ioctl (void *arg){ rtems_libio_ioctl_args_t *args = arg; struct rtems_termios_tty *tty = args->iop->data1; rtems_status_code sc; args->ioctl_return = 0; sc = rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT); if (sc != RTEMS_SUCCESSFUL) { args->ioctl_return = sc; return sc; } switch (args->command) { default: sc = RTEMS_INVALID_NUMBER; break; case RTEMS_IO_GET_ATTRIBUTES: *(struct termios *)args->buffer = tty->termios; break; case RTEMS_IO_SET_ATTRIBUTES: tty->termios = *(struct termios *)args->buffer; /* check for and process change in flow control options */ termios_set_flowctrl(tty); if (tty->termios.c_lflag & ICANON) { tty->rawInBufSemaphoreOptions = RTEMS_WAIT; tty->rawInBufSemaphoreTimeout = RTEMS_NO_TIMEOUT; tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT; } else { rtems_interval ticksPerSecond; rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticksPerSecond); tty->vtimeTicks = tty->termios.c_cc[VTIME] * ticksPerSecond / 10; if (tty->termios.c_cc[VTIME]) { tty->rawInBufSemaphoreOptions = RTEMS_WAIT; tty->rawInBufSemaphoreTimeout = tty->vtimeTicks; if (tty->termios.c_cc[VMIN]) tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT; else tty->rawInBufSemaphoreFirstTimeout = tty->vtimeTicks; } else { if (tty->termios.c_cc[VMIN]) { tty->rawInBufSemaphoreOptions = RTEMS_WAIT; tty->rawInBufSemaphoreTimeout = RTEMS_NO_TIMEOUT; tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT; } else { tty->rawInBufSemaphoreOptions = RTEMS_NO_WAIT; } } } if (tty->device.setAttributes) (*tty->device.setAttributes)(tty->minor, &tty->termios); break; case RTEMS_IO_TCDRAIN: drainOutput (tty); break; } rtems_semaphore_release (tty->osem); args->ioctl_return = sc; return sc;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/8ef38186faea3d9b5e6f0f1242f668cb7e7a3d52/termios.c/buggy/c/src/exec/libcsupport/src/termios.c |
|
size = BITS_IN_LONG - bfffo(n[2]); | size = BITS_IN_LONG - bfffo((ulong)n[2]); | pollardbrent(GEN n){ long tf = lgefint(n), size = 0, delta, retries = 0, msg_mask; long c0, c, k, k1, l, avP, avx, GGG, av = avma; GEN x, x1, y, P, g, g1, res; if (DEBUGLEVEL >= 4) (void)timer2(); /* clear timer */ if (tf >= 4) size = expi(n) + 1; else if (tf == 3) /* try to keep purify happy... */ size = BITS_IN_LONG - bfffo(n[2]); if (size <= 28) c0 = 32; /* amounts very nearly to `insist'. * Now that we have squfof(), we don't insist * any more when input is 2^29 ... 2^32 */ else if (size <= 42) c0 = tune_pb_min; else if (size <= 59) /* match squfof() cutoff point */ c0 = tune_pb_min + ((size - 42)<<1); else if (size <= 72) c0 = tune_pb_min + size - 24; else if (size <= 301) /* nonlinear increase in effort, kicking in around 80 bits */ /* 301 gives 48121 + tune_pb_min */ c0 = tune_pb_min + size - 60 + ((size-73)>>1)*((size-70)>>3)*((size-56)>>4); else c0 = 49152; /* ECM is faster when it'd take longer */ c = c0 << 5; /* 32 iterations per round */ msg_mask = (size >= 448? 0x1fff: (size >= 192? (256L<<((size-128)>>6))-1: 0xff));PB_RETRY: /* trick to make a `random' choice determined by n. Don't use x^2+0 or * x^2-2, ever. Don't use x^2-3 or x^2-7 with a starting value of 2. * x^2+4, x^2+9 are affine conjugate to x^2+1, so don't use them either. * * (the point being that when we get called again on a composite cofactor * of something we've already seen, we had better avoid the same delta) */ switch ((size + retries) & 7) { case 0: delta= 1; break; case 1: delta= -1; break; case 2: delta= 3; break; case 3: delta= 5; break; case 4: delta= -5; break; case 5: delta= 7; break; case 6: delta= 11; break; /* case 7: */ default: delta=-11; break; } if (DEBUGLEVEL >= 4) { if (!retries) { if (size < 1536) fprintferr("Rho: searching small factor of %ld-bit integer\n", size); else fprintferr("Rho: searching small factor of %ld-word integer\n", tf-2); } else fprintferr("Rho: restarting for remaining rounds...\n"); fprintferr("Rho: using X^2%+1ld for up to %ld rounds of 32 iterations\n", delta, c >> 5); flusherr(); } x=gdeux; P=gun; g1 = NULL; k = 1; l = 1; (void)new_chunk(10 + 6 * tf); /* enough for cgetg(10) + 3 divii */ y = cgeti(tf); affsi(2, y); x1= cgeti(tf); affsi(2, x1); avx = avma; avP = (long)new_chunk(2 * tf); /* enough for x = addsi(tf+1) */ GGG = (long)new_chunk(4 * tf); /* enough for P = modii(2tf+1, tf) */ for (;;) /* terminated under the control of c */ { /* use the polynomial x^2 + delta */#define one_iter() {\ avma = GGG; x = resii(sqri(x), n); /* to garbage zone */\ avma = avx; x = addsi(delta,x); /* erase garbage */\ avma = GGG; P = mulii(P, subii(x1, x));\ avma = avP; P = modii(P,n); } one_iter(); if ((--c & 0x1f)==0) /* one round complete */ { g = mppgcd(n, P); if (!is_pm1(g)) goto fin; /* caught something */ if (c <= 0) { /* getting bored */ if (DEBUGLEVEL >= 4) { fprintferr("Rho: time = %6ld ms,\tPollard-Brent giving up.\n", timer2()); flusherr(); } avma=av; return NULL; } P = gun; /* not necessary, but saves 1 mulii/round */ if (DEBUGLEVEL >= 4) rho_dbg(c0-(c>>5), msg_mask); affii(x,y); } if (--k) continue; /* normal end of loop body */ if (c & 0x1f) /* otherwise, we already checked */ { g = mppgcd(n, P); if (!is_pm1(g)) goto fin; P = gun; } /* Fast forward phase, doing l inner iterations without computing gcds. * Check first whether it would take us beyond the alloted time. * Fast forward rounds count only half (although they're taking * more like 2/3 the time of normal rounds). This to counteract the * nuisance that all c0 between 4096 and 6144 would act exactly as * 4096; with the halving trick only the range 4096..5120 collapses * (similarly for all other powers of two) */ if ((c-=(l>>1)) <= 0) { /* got bored */ if (DEBUGLEVEL >= 4) { fprintferr("Rho: time = %6ld ms,\tPollard-Brent giving up.\n", timer2()); flusherr(); } avma=av; return NULL; } c &= ~0x1f; /* keep it on multiples of 32 */ /* Fast forward loop */ affii(x, x1); k = l; l <<= 1; /* don't show this for the first several (short) fast forward phases. */ if (DEBUGLEVEL >= 4 && (l>>7) > msg_mask) { fprintferr("Rho: fast forward phase (%ld rounds of 64)...\n", l>>7); flusherr(); } for (k1=k; k1; k1--) one_iter(); if (DEBUGLEVEL >= 4 && (l>>7) > msg_mask) { fprintferr("Rho: time = %6ld ms,\t%3ld rounds, back to normal mode\n", timer2(), c0-(c>>5)); flusherr(); } affii(x,y); } /* forever */fin: /* An accumulated gcd was > 1 */ /* if it isn't n, and looks prime, return it */ if (!egalii(g,n)) { if (miller(g,17)) { if (DEBUGLEVEL >= 4) { rho_dbg(c0-(c>>5), 0); fprintferr("\tfound factor = %Z\n",g); flusherr(); } avma=av; return icopy(g); } avma = avx; g1 = icopy(g); /* known composite, keep it safe */ avx = avma; } else g1 = n; /* and work modulo g1 for backtracking */ /* Here g1 is known composite */ if (DEBUGLEVEL >= 4 && size > 192) { fprintferr("Rho: hang on a second, we got something here...\n"); flusherr(); } for(;;) /* backtrack until period recovered. Must terminate */ { avma = GGG; y = resii(sqri(y), g1); avma = avx; y = addsi(delta,y); g = mppgcd(subii(x1, y), g1); if (!is_pm1(g)) break; if (DEBUGLEVEL >= 4 && (--c & 0x1f) == 0) rho_dbg(c0-(c>>5), msg_mask); } avma = av; /* safe */ if (g1 == n || egalii(g,g1)) { if (g1 == n && egalii(g,g1)) { /* out of luck */ if (DEBUGLEVEL >= 4) { rho_dbg(c0-(c>>5), 0); fprintferr("\tPollard-Brent failed.\n"); flusherr(); } if (++retries >= 4) return NULL; goto PB_RETRY; } /* half lucky: we've split n, but g1 equals either g or n */ if (DEBUGLEVEL >= 4) { rho_dbg(c0-(c>>5), 0); fprintferr("\tfound %sfactor = %Z\n", (g1!=n ? "composite " : ""), g); flusherr(); } res = cgetg(7, t_VEC); res[1] = licopy(g); /* factor */ res[2] = un; /* exponent 1 */ res[3] = (g1!=n? zero: (long)NULL); /* known composite when g1!=n */ res[4] = ldivii(n,g); /* cofactor */ res[5] = un; /* exponent 1 */ res[6] = (long)NULL; /* unknown */ return res; } /* g < g1 < n : our lucky day -- we've split g1, too */ res = cgetg(10, t_VEC); /* unknown status for all three factors */ res[1] = licopy(g); res[2] = un; res[3] = (long)NULL; res[4] = ldivii(g1,g); res[5] = un; res[6] = (long)NULL; res[7] = ldivii(n,g1); res[8] = un; res[9] = (long)NULL; if (DEBUGLEVEL >= 4) { rho_dbg(c0-(c>>5), 0); fprintferr("\tfound factors = %Z, %Z,\n\tand %Z\n", res[1], res[4], res[7]); flusherr(); } return res;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/6f0450eaf26bb1653fbb257487c2cbc116d69406/ifactor1.c/buggy/src/basemath/ifactor1.c |
GEN y,p1; | GEN y, p1; | grndtoi(GEN x, long *e){ GEN y,p1; long i, tx=typ(x), lx, ex, e1; pari_sp av; *e = -(long)HIGHEXPOBIT; switch(tx) { case t_INT: case t_INTMOD: case t_QUAD: case t_FRAC: case t_FRACN: return ground(x); case t_REAL: av=avma; p1=gadd(ghalf,x); ex=expo(p1); if (ex<0) { if (signe(p1)>=0) { *e=expo(x); avma=av; return gzero; } *e=expo(addsr(1,x)); avma=av; return negi(gun); } lx=lg(x); e1 = ex - bit_accuracy(lx) + 1; y = ishiftr_spec(p1, lx, e1); if (signe(x)<0) y=addsi(-1,y); y = gerepileuptoint(av,y); if (e1<=0) { av=avma; e1=expo(subri(x,y)); avma=av; } *e=e1; return y; case t_POLMOD: y=cgetg(3,t_POLMOD); copyifstack(x[1],y[1]); y[2]=lrndtoi((GEN)x[2],e); return y; case t_COMPLEX: case t_POL: case t_SER: case t_RFRAC: case t_RFRACN: case t_VEC: case t_COL: case t_MAT: lx=(tx==t_POL)? lgef(x): lg(x); y=cgetg(lx,tx); for (i=1; i<lontyp[tx]; i++) y[i]=x[i]; for ( ; i<lx; i++) { y[i]=lrndtoi((GEN)x[i],&e1); if (e1>*e) *e=e1; } return y; } err(typeer,"grndtoi"); return NULL; /* not reached */} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b53fbf3ef78e3e359303ad08d2633e5a363a8bf1/gen3.c/buggy/src/basemath/gen3.c |
av=avma; p1=gadd(ghalf,x); ex=expo(p1); if (ex<0) | av = avma; p1 = gadd(ghalf,x); ex = expo(p1); if (ex < 0) | grndtoi(GEN x, long *e){ GEN y,p1; long i, tx=typ(x), lx, ex, e1; pari_sp av; *e = -(long)HIGHEXPOBIT; switch(tx) { case t_INT: case t_INTMOD: case t_QUAD: case t_FRAC: case t_FRACN: return ground(x); case t_REAL: av=avma; p1=gadd(ghalf,x); ex=expo(p1); if (ex<0) { if (signe(p1)>=0) { *e=expo(x); avma=av; return gzero; } *e=expo(addsr(1,x)); avma=av; return negi(gun); } lx=lg(x); e1 = ex - bit_accuracy(lx) + 1; y = ishiftr_spec(p1, lx, e1); if (signe(x)<0) y=addsi(-1,y); y = gerepileuptoint(av,y); if (e1<=0) { av=avma; e1=expo(subri(x,y)); avma=av; } *e=e1; return y; case t_POLMOD: y=cgetg(3,t_POLMOD); copyifstack(x[1],y[1]); y[2]=lrndtoi((GEN)x[2],e); return y; case t_COMPLEX: case t_POL: case t_SER: case t_RFRAC: case t_RFRACN: case t_VEC: case t_COL: case t_MAT: lx=(tx==t_POL)? lgef(x): lg(x); y=cgetg(lx,tx); for (i=1; i<lontyp[tx]; i++) y[i]=x[i]; for ( ; i<lx; i++) { y[i]=lrndtoi((GEN)x[i],&e1); if (e1>*e) *e=e1; } return y; } err(typeer,"grndtoi"); return NULL; /* not reached */} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/b53fbf3ef78e3e359303ad08d2633e5a363a8bf1/gen3.c/buggy/src/basemath/gen3.c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.