rem
stringlengths 0
83.5k
| add
stringlengths 0
223k
| context
stringlengths 10
471k
| meta
stringlengths 120
236
|
---|---|---|---|
if ( cause & 0x20 ) /* IP[3] ==> INT4 */ CALL_ISR( MONGOOSEV_IRQ_INT4 ); | if ( cshifted & 0x20 ) /* IP[3] ==> INT3 == FPU interrupt */ CALL_ISR( MONGOOSEV_IRQ_INT3, frame ); | void mips_vector_isr_handlers( void ){ unsigned int sr; unsigned int cause; int bit; unsigned int pf_icr; mips_get_sr( sr ); mips_get_cause( cause ); cause &= (sr & SR_IMASK); cause >>= CAUSE_IPSHIFT; if ( cause & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1 ); if ( cause & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2 ); if ( cause & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2 ); if ( cause & 0x20 ) /* IP[3] ==> INT4 */ CALL_ISR( MONGOOSEV_IRQ_INT4 ); if ( cause & 0x40 ) { /* IP[4] ==> INT5 */ pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* XXX if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit ); } } if ( cause & 0x02 ) /* SW[0] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1 ); if ( cause & 0x01 ) /* IP[1] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2 );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2e7ed911d7a99274d5268498a3466de06f580d8a/vectorisrs.c/clean/c/src/lib/libcpu/mips/mongoosev/vectorisrs/vectorisrs.c |
if ( cause & 0x40 ) { /* IP[4] ==> INT5 */ pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* XXX if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit ); } | if ( cshifted & 0x40 ) /* IP[4] ==> INT4, external interrupt */ CALL_ISR( MONGOOSEV_IRQ_INT4, frame ); if ( cshifted & 0x80 ) /* IP[5] ==> INT5, peripheral interrupt */ { pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) { CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit, frame ); } } | void mips_vector_isr_handlers( void ){ unsigned int sr; unsigned int cause; int bit; unsigned int pf_icr; mips_get_sr( sr ); mips_get_cause( cause ); cause &= (sr & SR_IMASK); cause >>= CAUSE_IPSHIFT; if ( cause & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1 ); if ( cause & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2 ); if ( cause & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2 ); if ( cause & 0x20 ) /* IP[3] ==> INT4 */ CALL_ISR( MONGOOSEV_IRQ_INT4 ); if ( cause & 0x40 ) { /* IP[4] ==> INT5 */ pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* XXX if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit ); } } if ( cause & 0x02 ) /* SW[0] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1 ); if ( cause & 0x01 ) /* IP[1] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2 );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2e7ed911d7a99274d5268498a3466de06f580d8a/vectorisrs.c/clean/c/src/lib/libcpu/mips/mongoosev/vectorisrs/vectorisrs.c |
if ( cause & 0x02 ) /* SW[0] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1 ); | void mips_vector_isr_handlers( void ){ unsigned int sr; unsigned int cause; int bit; unsigned int pf_icr; mips_get_sr( sr ); mips_get_cause( cause ); cause &= (sr & SR_IMASK); cause >>= CAUSE_IPSHIFT; if ( cause & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1 ); if ( cause & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2 ); if ( cause & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2 ); if ( cause & 0x20 ) /* IP[3] ==> INT4 */ CALL_ISR( MONGOOSEV_IRQ_INT4 ); if ( cause & 0x40 ) { /* IP[4] ==> INT5 */ pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* XXX if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit ); } } if ( cause & 0x02 ) /* SW[0] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1 ); if ( cause & 0x01 ) /* IP[1] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2 );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2e7ed911d7a99274d5268498a3466de06f580d8a/vectorisrs.c/clean/c/src/lib/libcpu/mips/mongoosev/vectorisrs/vectorisrs.c |
|
if ( cause & 0x01 ) /* IP[1] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2 ); | /* all the pending interrupts were serviced, now re-enable them */ mips_get_sr( sr ); /* we allow the 2 software interrupts to nest freely, under the * assumption that the program knows what its doing... */ if( cshifted & 0x3 ) { sr |= (SR_IBIT1 | SR_IBIT1); cause &= ~(SR_IBIT1 | SR_IBIT1); mips_set_cause(cause); mips_set_sr(sr); if ( cshifted & 0x01 ) /* SW[0] */ { CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1, frame ); } if ( cshifted & 0x02 ) /* SW[1] */ { CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2, frame ); } } sr |= cause; mips_set_sr( sr ); | void mips_vector_isr_handlers( void ){ unsigned int sr; unsigned int cause; int bit; unsigned int pf_icr; mips_get_sr( sr ); mips_get_cause( cause ); cause &= (sr & SR_IMASK); cause >>= CAUSE_IPSHIFT; if ( cause & 0x04 ) /* IP[0] ==> INT0 == TIMER1 */ CALL_ISR( MONGOOSEV_IRQ_TIMER1 ); if ( cause & 0x08 ) /* IP[1] ==> INT1 == TIMER2*/ CALL_ISR( MONGOOSEV_IRQ_TIMER2 ); if ( cause & 0x10 ) /* IP[2] ==> INT2 */ CALL_ISR( MONGOOSEV_IRQ_INT2 ); if ( cause & 0x20 ) /* IP[3] ==> INT4 */ CALL_ISR( MONGOOSEV_IRQ_INT4 ); if ( cause & 0x40 ) { /* IP[4] ==> INT5 */ pf_icr = MONGOOSEV_READ( MONGOOSEV_PERIPHERAL_FUNCTION_INTERRUPT_CAUSE_REGISTER ); /* XXX if !pf_icr */ for ( bit=0 ; bit <= 31 ; bit++, pf_icr >>= 1 ) { if ( pf_icr & 1 ) CALL_ISR( MONGOOSEV_IRQ_PERIPHERAL_BASE + bit ); } } if ( cause & 0x02 ) /* SW[0] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_1 ); if ( cause & 0x01 ) /* IP[1] */ CALL_ISR( MONGOOSEV_IRQ_SOFTWARE_2 );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2e7ed911d7a99274d5268498a3466de06f580d8a/vectorisrs.c/clean/c/src/lib/libcpu/mips/mongoosev/vectorisrs/vectorisrs.c |
#endif | checkmemory(GEN z){ if (DEBUGMEM && memused != (size_t)-1 && ((GEN)memused > z + MEMSTEP || z > (GEN)memused + MEMSTEP)) { memused=(size_t)z;#if MEMSTEP >= 1048576 fprintferr("...%4.0lf Mbytes used\n",(top-memused)/1048576.);#else fprintferr("...%5.1lf Mbytes used\n",(top-memused)/1048576.);#endif }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/11a188306fa94d4ab6dcadd2a00a9c1608898713/init.c/buggy/src/language/init.c |
|
unsigned32 file_size = 0; unsigned32 buf_size = 0; | uint32_t file_size = 0; uint32_t buf_size = 0; | void fileio_write_file(void){ char fname[1024]; char tmp_str[32]; unsigned32 file_size = 0; unsigned32 buf_size = 0; size_t curr_pos,bytes_to_copy; int fd = -1; ssize_t n; rtems_interval start_tick,curr_tick,ticks_per_sec; char *bufptr = NULL; boolean failed = FALSE; static const char write_test_string[] = "The quick brown fox jumps over the lazy dog\n"; static const char write_block_string[] = "\n----- end of write buffer ------\n"; printf(" =========================\n"); printf(" WRITE FILE ... \n"); printf(" =========================\n"); fileio_print_free_heap(); /* * get number of ticks per second */ rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_sec); /* * get path to file to write */ if (!failed) { printf("Enter path/filename ==>"); fgets(fname,sizeof(fname)-1,stdin); while (fname[strlen(fname)-1] == '\n') { fname[strlen(fname)-1] = '\0'; } if (0 == strlen(fname)) { printf("*** no filename entered, aborted\n"); failed = TRUE; } } /* * get total file size to write */ if (!failed) { printf("use suffix K for Kbytes, M for Mbytes or no suffix for bytes:\n" "Enter filesize to write ==>"); fgets(tmp_str,sizeof(tmp_str)-1,stdin); failed = fileio_str2size(tmp_str,&file_size); if (failed) { printf("*** illegal file size, aborted\n"); } } /* * get block size to write */ if (!failed) { printf("use suffix K for Kbytes, M for Mbytes or no suffix for bytes:\n" "Enter block size to use for write calls ==>"); fgets(tmp_str,sizeof(tmp_str)-1,stdin); failed = fileio_str2size(tmp_str,&buf_size); if (failed) { printf("*** illegal block size, aborted\n"); } } /* * allocate buffer */ if (!failed) { printf("... allocating %lu bytes of buffer for write data\n", (unsigned long)buf_size); bufptr = malloc(buf_size+1); /* extra space for terminating NUL char */ if (bufptr == NULL) { printf("*** malloc failed, aborted\n"); failed = TRUE; } } /* * fill buffer with test pattern */ if (!failed) { printf("... filling buffer with write data\n"); curr_pos = 0; /* * fill buffer with test string */ while (curr_pos < buf_size) { bytes_to_copy = MIN(buf_size-curr_pos, sizeof(write_test_string)-1); memcpy(bufptr+curr_pos,write_test_string,bytes_to_copy); curr_pos += bytes_to_copy; } /* * put "end" mark at end of buffer */ bytes_to_copy = sizeof(write_block_string)-1; if (buf_size >= bytes_to_copy) { memcpy(bufptr+buf_size-bytes_to_copy, write_block_string, bytes_to_copy); } } /* * create file */ if (!failed) { printf("... creating file \"%s\"\n",fname); fd = open(fname,O_WRONLY | O_CREAT | O_TRUNC,S_IREAD|S_IWRITE); if (fd < 0) { printf("*** file create failed, errno = %d(%s)\n",errno,strerror(errno)); failed = TRUE; } } /* * write file */ if (!failed) { printf("... writing to file\n"); rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start_tick); curr_pos = 0; do { bytes_to_copy = buf_size; do { n = write(fd, bufptr + (buf_size-bytes_to_copy), MIN(bytes_to_copy,file_size-curr_pos)); if (n > 0) { bytes_to_copy -= n; curr_pos += n; } } while ((bytes_to_copy > 0) && (n > 0)); } while ((file_size > curr_pos) && (n > 0)); rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &curr_tick); if (n < 0) { failed = TRUE; printf("*** file write failed, " "%lu bytes written, " "errno = %d(%s)\n", (unsigned long)curr_pos,errno,strerror(errno)); } else { printf("time elapsed for write: %g seconds\n", ((double)curr_tick-start_tick)/ticks_per_sec); printf("write data rate: %g KBytes/second\n", (((double)file_size) / 1024.0 / (((double)curr_tick-start_tick)/ticks_per_sec))); } } if (fd >= 0) { printf("... closing file\n"); close(fd); } if (bufptr != NULL) { printf("... deallocating buffer\n"); free(bufptr); bufptr = NULL; } printf("\n ******** End of file write\n"); fileio_print_free_heap();} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/4c84d7b760ceb1e140c1cfc0fa64289ca4d243ed/init.c/buggy/testsuites/samples/fileio/init.c |
long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; | gpmem_t av = avma; GEN theta, nf, rel, aux, H, Y, M, A, suni, sunitrel, futu, fu, tu, w, k, T; GEN prod, S1, S2; GEN res = cgetg(3,t_VEC), relpol = (GEN)ext[1], rnfeq = (GEN)ext[2]; long L, i, drel; | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) | if (typ(ext)!=t_VEC || lg(ext)!=4 || typ(relpol)!=t_POL) err(typeer,"rnfisnorm"); if (typ(rnfeq) == t_VEC) | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; | if (lg(rnfeq) != 4) err(typeer, "rnfisnorm"); k = (GEN)rnfeq[3]; } else { if (typ(rnfeq) != t_INT) err(typeer, "rnfisnorm"); k = rnfeq; | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ | bnf = checkbnf(bnf); nf = checknf(bnf); T = (GEN)nf[1]; if (typ(x) != t_POL) x = basistoalg(nf,x); if (gvar(x) != varn(T)) err(consister, "rnfisnorm"); drel = degpol(relpol); if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && odd(drel))) { res[1] = (long)x; res[2] = un; return gerepilecopy(av, res); } | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) | /* build set S of ideals involved in the solutions */ rel = checkbnf((GEN)ext[3]); fu = check_units(rel,"rnfisnorm"); prod = gun; S1 = S2 = cgetg(1,t_VEC); if (!gcmp1(gmael3(rel,8,1,1))) | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); | GEN gen = gmael3(rel,8,1,3); GEN cyc = gmael3(rel,8,1,2), dext = stoi(drel); for(i=1;i<lg(gen);i++) { if (gcmp1(ggcd((GEN)cyc[i], dext))) break; fa_pr_append(nf,rel,gmael3(gen,i,1,1),&prod,&S1,&S2); } | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) | byteptr d = diffptr; long p = 0; if (maxprime() < flag) err(primer1); for(;;) | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); | NEXT_PRIME_VIADIFF(p, d); if (p > flag) break; pr_append(nf,rel,stoi(p),&prod,&S1,&S2); | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
{ listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } | fa_pr_append(nf,rel,stoi(-flag),&prod,&S1,&S2); | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); | GEN Ndiscrel=divii((GEN)checknf(rel)[3], gpowgs((GEN)nf[3], drel)); fa_pr_append(nf,rel,absi(Ndiscrel), &prod,&S1,&S2); | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } | fa_pr_append(nf,rel,idealnorm(nf,x), &prod,&S1,&S2); | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); | /* computation on S-units */ w = gmael3(rel,8,4,1); tu = gmael3(rel,8,4,2); futu = concatsp(fu, tu); suni = bnfsunit(bnf,S1,PREC); sunitrel = (GEN)bnfsunit(rel,S2,PREC)[1]; if (lg(sunitrel)>1) sunitrel = lift(basistoalg(rel,sunitrel)); sunitrel = concatsp(futu, sunitrel); | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
/* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) | A = lift(bnfissunit(bnf,suni,x)); L = lg(sunitrel); M = cgetg(L+1,t_MAT); theta = get_theta_abstorel(T, relpol, k); for (i=1; i<L; i++) | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); | GEN u = (GEN)sunitrel[i]; u = poleval(u, theta); M[i] = llift( bnfissunit(bnf,suni, gnorm(u)) ); if (lg(M[i]) == 1) err(bugparier,"rnfisnorm"); sunitrel[i] = (long)u; | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) | aux = zerocol(lg(A)-1); aux[lg(futu)-1] = (long)w; M[L] = (long)aux; /* correspond to 1 */ H = hnfall0(M, 0); Y = gmul((GEN)H[2], inverseimage((GEN)H[1],A)); /* Y: sols of MY = A over Q */ setlg(Y, L); aux = factorback(sunitrel, gfloor(Y)); x = gdiv(x, gnorm(gmodulcp(lift(aux),relpol))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || !degpol(x[2]))) | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res); | res[1] = (long)aux; res[2] = (long)x; return gerepilecopy(av, res); | rnfisnorm(GEN bnf,GEN ext,GEN x,long flag,long PREC){ long lgsunitrelnf,i; gpmem_t ltop = avma; GEN listp,relnf,aux,vec,tors,xnf,H,Y,M,A,suni,sunitrelnf,sunitnormnf,prod; GEN res = cgetg(3,t_VEC), S1,S2; if (typ(ext)!=t_VEC || lg(ext)!=4) err (typeer,"bnfisnorm"); if (typ(x)!=t_POL) x = basistoalg(bnf,x); bnf = checkbnf(bnf); relnf = (GEN)ext[3]; if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && (degpol(ext[1])&1))) { avma = (gpmem_t)res; res[1]=lcopy(x); res[2]=un; return res; }/* construction de l'ensemble S des ideaux qui interviennent dans les solutions */ prod=gun; S1=S2=cgetg(1,t_VEC); if (!gcmp1(gmael3(relnf,8,1,1))) { GEN genclass=gmael3(relnf,8,1,3); vec=cgetg(1,t_VEC); for(i=1;i<lg(genclass);i++) if (!gcmp1(ggcd(gmael4(relnf,8,1,2,i), stoi(degpol(ext[1]))))) vec=concatsp(vec,(GEN)factor(gmael3(genclass,i,1,1))[1]); vecconcat(bnf,relnf,vec,&prod,&S1,&S2); } if (flag > 1) { i = cgcd(flag, smodis(prod,flag)); if (i > 1) flag /= i; /* don't include same primes twice */ listp = (GEN)factor(stoi(flag))[1]; for (i=1; i<lg(listp); i++) { GEN p = (GEN)listp[i]; prod = mulii(prod,p); S1 = concatsp(S1,primedec(bnf,p)); S2 = concatsp(S2,primedec(relnf,p)); } } else if (flag < 0) { listp = (GEN)factor(stoi(-flag))[1]; vecconcat(bnf,relnf,listp,&prod,&S1,&S2); } if (flag) { GEN normdiscrel=divii(gmael(relnf,7,3), gpuigs(gmael(bnf,7,3),lg(ext[1])-3)); vecconcat(bnf,relnf,(GEN) factor(absi(normdiscrel))[1], &prod,&S1,&S2); } vec=(GEN)idealfactor(bnf,x)[1]; aux=cgetg(2,t_VEC); for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S1=concatsp(S1,aux); } xnf=lift(x); xnf=gsubst(xnf,varn(xnf),(GEN)ext[2]); vec=(GEN) idealfactor(relnf,xnf)[1]; for (i=1; i<lg(vec); i++) if (signe(resii(prod,gmael(vec,i,1)))) { aux[1]=vec[i]; S2=concatsp(S2,aux); } res[1]=un; res[2]=(long)x; tors=cgetg(2,t_VEC); tors[1]=mael3(relnf,8,4,2); /* calcul sur les S-unites */ suni=bnfsunit(bnf,S1,PREC); A=lift(bnfissunit(bnf,suni,x)); sunitrelnf=(GEN) bnfsunit(relnf,S2,PREC)[1]; if (lg(sunitrelnf)>1) { sunitrelnf=lift(basistoalg(relnf,sunitrelnf)); sunitrelnf=concatsp(tors,sunitrelnf); } else sunitrelnf=tors; aux=(GEN)relnf[8]; if (lg(aux)>=6) aux=(GEN)aux[5]; else { aux=buchfu(relnf); if(gcmp0((GEN)aux[2])) err(precer,"bnfisnorm, please increase precision and try again"); aux=(GEN)aux[1]; } if (lg(aux)>1) sunitrelnf=concatsp(aux,sunitrelnf); lgsunitrelnf=lg(sunitrelnf); M=cgetg(lgsunitrelnf+1,t_MAT); sunitnormnf=cgetg(lgsunitrelnf,t_VEC); for (i=1; i<lgsunitrelnf; i++) { sunitnormnf[i]=lnorm(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1])); M[i]=llift(bnfissunit(bnf,suni,(GEN) sunitnormnf[i])); } M[lgsunitrelnf]=lgetg(lg(A),t_COL); for (i=1; i<lg(A); i++) mael(M,lgsunitrelnf,i)=zero; mael(M,lgsunitrelnf,lg(mael(bnf,7,6))-1)=mael3(bnf,8,4,1); H=hnfall(M); Y=inverseimage(gmul(M,(GEN) H[2]),A); Y=gmul((GEN) H[2],Y); for (aux=(GEN)res[1],i=1; i<lgsunitrelnf; i++) aux=gmul(aux,gpuigs(gmodulcp((GEN) sunitrelnf[i],(GEN)ext[1]), itos(gfloor((GEN)Y[i])))); x = gdiv(x,gnorm(gmodulcp(lift(aux),(GEN)ext[1]))); if (typ(x) == t_POLMOD && (typ(x[2]) != t_POL || lgef(x[2]) == 3)) { x = (GEN)x[2]; /* rational number */ if (typ(x) == t_POL) x = (GEN)x[2]; } res[1]=(long)aux; res[2]=(long)x; return gerepilecopy(ltop,res);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/buch4.c/buggy/src/basemath/buch4.c |
prodid(GEN nf, GEN I){ long i, l = lg(I); GEN z; if (l == 1) return idmat(degpol(nf[1])); z = (GEN)I[1]; for (i=2; i<l; i++) z = idealmul(nf, z, (GEN)I[i]); return z;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59f511650949bd335c0ea3ba14f6dd6ce94d3308/base5.c/clean/src/basemath/base5.c |
||
long av=avma,tetpil,m,n,r1,r2,vnf,i,j,k,vpol,v1,r1j,r2j,lfac,degabs; | ulong av = avma; long m,n,r1,r2,vnf,i,j,k,vpol,v1,r1j,r2j,lfac,degabs; | rnfinitalg(GEN nf,GEN pol,long prec){ long av=avma,tetpil,m,n,r1,r2,vnf,i,j,k,vpol,v1,r1j,r2j,lfac,degabs; GEN RES,sig,rac,p1,p2,liftpol,delta,RAC,ro,p3,bas; GEN f,f2,fac,fac1,fac2,id,p4,p5; if (typ(pol)!=t_POL) err(notpoler,"rnfinitalg"); nf=checknf(nf); n=degpol(pol); vpol=varn(pol); vnf=0; for (i=0; i<=n; i++) { long tp1; p1=(GEN)pol[i+2]; tp1=typ(p1); if (! is_const_t(tp1)) { if (tp1!=t_POLMOD) err(typeer,"rnfinitalg"); p1 = checknfelt_mod(nf, p1, "rnfinitalg"); if (! is_const_t(typ(p1))) { v1=varn(p1); if (vnf && vnf!=v1) err(talker,"different variables in rnfinitalg"); if (!vnf) vnf=v1; } } } if (!vnf) vnf=varn(nf[1]); if (vpol>=vnf) err(talker,"main variable must be of higher priority in rnfinitalg"); RES=cgetg(12,t_VEC); RES[1]=(long)pol; m=degpol(nf[1]); degabs=n*m; r1 = nf_get_r1(nf); r2 = (m-r1) >> 1; sig=cgetg(r1+r2+1,t_VEC); RES[2]=(long)sig; rac=(GEN)nf[6]; liftpol=lift(pol); RAC=cgetg(r1+r2+1,t_VEC); RES[6]=(long)RAC; for (j=1; j<=r1; j++) { p1=gsubst(liftpol,vnf,(GEN)rac[j]); ro=roots(p1,prec); r1j=0; while (r1j<n && gcmp0(gimag((GEN)ro[r1j+1]))) r1j++; p2=cgetg(3,t_VEC); p2[1]=lstoi(r1j); p2[2]=lstoi(r2j=((n-r1j)>>1)); sig[j]=(long)p2; p3=cgetg(r1j+r2j+1,t_VEC); for (i=1; i<=r1j; i++) p3[i]=lreal((GEN)ro[i]); for (; i<=r1j+r2j; i++) p3[i]=(long)ro[(i<<1)-r1j]; RAC[j]=(long)p3; } for (; j<=r1+r2; j++) { p2=cgetg(3,t_VEC); p2[1]=zero; p2[2]=lstoi(n); sig[j]=(long)p2; p1=gsubst(liftpol,vnf,(GEN)rac[j]); RAC[j]=(long)roots(p1,prec); } p1 = rnfpseudobasis(nf,pol); delta = cgetg(3,t_VEC); delta[1]=p1[3]; delta[2]=p1[4]; RES[3]=(long)delta; p2 = matbasistoalg(nf,(GEN)p1[1]); bas = cgetg(3,t_VEC); bas[1]=(long)mat_to_vecpol(p2,vpol); bas[2]=(long)p1[2]; RES[7]=(long)bas; RES[8]=linvmat(p2); f2=idealdiv(nf,discsr(pol),(GEN)p1[3]); fac=idealfactor(nf,f2); fac1=(GEN)fac[1]; fac2=(GEN)fac[2]; lfac=lg(fac1)-1; f=idmat(m); for (i=1; i<=lfac; i++) { if (mpodd((GEN)fac2[i])) err(bugparier,"rnfinitalg (odd exponent)"); f=idealmul(nf,f,idealpow(nf,(GEN)fac1[i],gmul2n((GEN)fac2[i],-1))); } RES[4]=(long)f; RES[10]=(long)nf; RES[5]=(long)rnfmakematrices(RES); if (DEBUGLEVEL>1) msgtimer("matrices"); RES[9]=lgetg(1,t_VEC); /* table de multiplication */ p2=cgetg(6,t_VEC); RES[11]=(long)p2; p1=rnfequation2(nf,pol); for (i=1; i<=3; i++) p2[i]=p1[i]; p4=cgetg(degabs+1,t_MAT); for (i=1; i<=n; i++) { /* removing denominators speeds up multiplication */ GEN cop3,com, om = rnfelementreltoabs(RES,gmael(bas,1,i)); if (DEBUGLEVEL>1) msgtimer("i = %ld",i); com = content(om); om = gdiv(om,com); id=gmael(bas,2,i); for (j=1; j<=m; j++) { p5=cgetg(degabs+1,t_COL); p4[(i-1)*m+j]=(long)p5; p1=gmul((GEN)nf[7],(GEN)id[j]); p3 = gsubst(p1,varn(nf[1]), (GEN)p2[2]); cop3 = content(p3); p3 = gdiv(p3,cop3); p3 = gmul(gmul(com,cop3), lift_intern(gmul(om,p3))); for (k=1; k<lgef(p3)-1; k++) p5[k]=p3[k+1]; for ( ; k<=degabs; k++) p5[k]=zero; } } if (DEBUGLEVEL>1) msgtimer("p4"); p3 = denom(p4); p4 = hnfmodid(gmul(p3,p4), p3); if (DEBUGLEVEL>1) msgtimer("hnfmod"); for (j=degabs-1; j>0; j--) if (cmpis(gcoeff(p4,j,j),2) > 0) { p1=shifti(gcoeff(p4,j,j),-1); for (k=j+1; k<=degabs; k++) if (cmpii(gcoeff(p4,j,k),p1) > 0) for (i=1; i<=j; i++) coeff(p4,i,k)=lsubii(gcoeff(p4,i,k),gcoeff(p4,i,j)); } p4 = gdiv(p4,p3); p2[4]=(long)mat_to_vecpol(p4,vpol); p2[5]=linvmat(p4); tetpil=avma; return gerepile(av,tetpil,gcopy(RES));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7168973a923818508c45aa17d871c53e9225fad1/base5.c/clean/src/basemath/base5.c |
tetpil=avma; return gerepile(av,tetpil,gcopy(RES)); | return gerepilecopy(av,RES); | rnfinitalg(GEN nf,GEN pol,long prec){ long av=avma,tetpil,m,n,r1,r2,vnf,i,j,k,vpol,v1,r1j,r2j,lfac,degabs; GEN RES,sig,rac,p1,p2,liftpol,delta,RAC,ro,p3,bas; GEN f,f2,fac,fac1,fac2,id,p4,p5; if (typ(pol)!=t_POL) err(notpoler,"rnfinitalg"); nf=checknf(nf); n=degpol(pol); vpol=varn(pol); vnf=0; for (i=0; i<=n; i++) { long tp1; p1=(GEN)pol[i+2]; tp1=typ(p1); if (! is_const_t(tp1)) { if (tp1!=t_POLMOD) err(typeer,"rnfinitalg"); p1 = checknfelt_mod(nf, p1, "rnfinitalg"); if (! is_const_t(typ(p1))) { v1=varn(p1); if (vnf && vnf!=v1) err(talker,"different variables in rnfinitalg"); if (!vnf) vnf=v1; } } } if (!vnf) vnf=varn(nf[1]); if (vpol>=vnf) err(talker,"main variable must be of higher priority in rnfinitalg"); RES=cgetg(12,t_VEC); RES[1]=(long)pol; m=degpol(nf[1]); degabs=n*m; r1 = nf_get_r1(nf); r2 = (m-r1) >> 1; sig=cgetg(r1+r2+1,t_VEC); RES[2]=(long)sig; rac=(GEN)nf[6]; liftpol=lift(pol); RAC=cgetg(r1+r2+1,t_VEC); RES[6]=(long)RAC; for (j=1; j<=r1; j++) { p1=gsubst(liftpol,vnf,(GEN)rac[j]); ro=roots(p1,prec); r1j=0; while (r1j<n && gcmp0(gimag((GEN)ro[r1j+1]))) r1j++; p2=cgetg(3,t_VEC); p2[1]=lstoi(r1j); p2[2]=lstoi(r2j=((n-r1j)>>1)); sig[j]=(long)p2; p3=cgetg(r1j+r2j+1,t_VEC); for (i=1; i<=r1j; i++) p3[i]=lreal((GEN)ro[i]); for (; i<=r1j+r2j; i++) p3[i]=(long)ro[(i<<1)-r1j]; RAC[j]=(long)p3; } for (; j<=r1+r2; j++) { p2=cgetg(3,t_VEC); p2[1]=zero; p2[2]=lstoi(n); sig[j]=(long)p2; p1=gsubst(liftpol,vnf,(GEN)rac[j]); RAC[j]=(long)roots(p1,prec); } p1 = rnfpseudobasis(nf,pol); delta = cgetg(3,t_VEC); delta[1]=p1[3]; delta[2]=p1[4]; RES[3]=(long)delta; p2 = matbasistoalg(nf,(GEN)p1[1]); bas = cgetg(3,t_VEC); bas[1]=(long)mat_to_vecpol(p2,vpol); bas[2]=(long)p1[2]; RES[7]=(long)bas; RES[8]=linvmat(p2); f2=idealdiv(nf,discsr(pol),(GEN)p1[3]); fac=idealfactor(nf,f2); fac1=(GEN)fac[1]; fac2=(GEN)fac[2]; lfac=lg(fac1)-1; f=idmat(m); for (i=1; i<=lfac; i++) { if (mpodd((GEN)fac2[i])) err(bugparier,"rnfinitalg (odd exponent)"); f=idealmul(nf,f,idealpow(nf,(GEN)fac1[i],gmul2n((GEN)fac2[i],-1))); } RES[4]=(long)f; RES[10]=(long)nf; RES[5]=(long)rnfmakematrices(RES); if (DEBUGLEVEL>1) msgtimer("matrices"); RES[9]=lgetg(1,t_VEC); /* table de multiplication */ p2=cgetg(6,t_VEC); RES[11]=(long)p2; p1=rnfequation2(nf,pol); for (i=1; i<=3; i++) p2[i]=p1[i]; p4=cgetg(degabs+1,t_MAT); for (i=1; i<=n; i++) { /* removing denominators speeds up multiplication */ GEN cop3,com, om = rnfelementreltoabs(RES,gmael(bas,1,i)); if (DEBUGLEVEL>1) msgtimer("i = %ld",i); com = content(om); om = gdiv(om,com); id=gmael(bas,2,i); for (j=1; j<=m; j++) { p5=cgetg(degabs+1,t_COL); p4[(i-1)*m+j]=(long)p5; p1=gmul((GEN)nf[7],(GEN)id[j]); p3 = gsubst(p1,varn(nf[1]), (GEN)p2[2]); cop3 = content(p3); p3 = gdiv(p3,cop3); p3 = gmul(gmul(com,cop3), lift_intern(gmul(om,p3))); for (k=1; k<lgef(p3)-1; k++) p5[k]=p3[k+1]; for ( ; k<=degabs; k++) p5[k]=zero; } } if (DEBUGLEVEL>1) msgtimer("p4"); p3 = denom(p4); p4 = hnfmodid(gmul(p3,p4), p3); if (DEBUGLEVEL>1) msgtimer("hnfmod"); for (j=degabs-1; j>0; j--) if (cmpis(gcoeff(p4,j,j),2) > 0) { p1=shifti(gcoeff(p4,j,j),-1); for (k=j+1; k<=degabs; k++) if (cmpii(gcoeff(p4,j,k),p1) > 0) for (i=1; i<=j; i++) coeff(p4,i,k)=lsubii(gcoeff(p4,i,k),gcoeff(p4,i,j)); } p4 = gdiv(p4,p3); p2[4]=(long)mat_to_vecpol(p4,vpol); p2[5]=linvmat(p4); tetpil=avma; return gerepile(av,tetpil,gcopy(RES));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7168973a923818508c45aa17d871c53e9225fad1/base5.c/clean/src/basemath/base5.c |
unsigned32 rtems_time; unsigned32 rtc_time; | uint32_t rtems_time; uint32_t rtc_time; | int checkRealTime(){ rtems_time_of_day rtems_tod; rtems_time_of_day rtc_tod; unsigned32 rtems_time; unsigned32 rtc_time; if (!RTC_Present) return -1; rtems_clock_get( RTEMS_CLOCK_GET_TOD, &rtems_tod ); RTC_Table[RTC_Minor].pDeviceFns->deviceGetTime(RTC_Minor, &rtc_tod); rtems_time = _TOD_To_seconds( &rtems_tod ); rtc_time = _TOD_To_seconds( &rtc_tod ); return rtems_time - rtc_time;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/a2ac7e100a2a3b061e8afe0d15d8867ce4abe63e/tod.c/clean/c/src/lib/libbsp/shared/tod.c |
GEN I0 = dummycopy(I), Wa; | GEN I0 = dummycopy(I), W0 = dummycopy(W), Wa; | rnfordmax(GEN nf, GEN pol, GEN pr, long vdisc){ pari_sp av = avma, av1, lim; long i, j, k, n, vpol, cmpt, sep; GEN q, q1, p, T, modpr, W, I, MW, C, p1; GEN Tauinv, Tau, prhinv, pip, nfT, id, rnfId; if (DEBUGLEVEL>1) fprintferr(" treating %Z\n",pr); modpr = nf_to_ff_init(nf,&pr,&T,&p); p1 = rnfdedekind_i(nf, pol, modpr, vdisc); if (!p1) { avma = av; return NULL; } if (gcmp1((GEN)p1[1])) return gerepilecopy(av,(GEN)p1[2]); sep = itos((GEN)p1[3]); W = gmael(p1,2,1); I = gmael(p1,2,2); pip = basistoalg(nf, (GEN)pr[2]); nfT = (GEN)nf[1]; n = degpol(pol); vpol = varn(pol); q = T? gpowgs(p,degpol(T)): p; q1 = q; while (cmpis(q1,n) < 0) q1 = mulii(q1,q); rnfId = idmat(n); id = idmat(degpol(nfT)); prhinv = idealinv(nf, pr); C = cgetg(n+1, t_MAT); for (j=1; j<=n; j++) C[j] = lgetg(n*n+1, t_COL); MW = cgetg(n*n+1, t_MAT); for (j=1; j<=n*n; j++) MW[j] = lgetg(n+1, t_COL); Tauinv = cgetg(n+1, t_VEC); Tau = cgetg(n+1, t_VEC); av1 = avma; lim = stack_lim(av1,1); for(cmpt=1; ; cmpt++) { GEN I0 = dummycopy(I), Wa; GEN Wainv, Waa; GEN Ip, A, Ainv, MWmod, F; GEN pseudo, G; if (DEBUGLEVEL>1) fprintferr(" %ld%s pass\n",cmpt,eng_ord(cmpt)); for (j=1; j<=n; j++) { GEN tau, tauinv; long v1, v2; if (gegal((GEN)I[j],id)) { Tau[j] = Tauinv[j] = un; continue; } p1 = ideal_two_elt(nf,(GEN)I[j]); v1 = element_val(nf,(GEN)p1[1],pr); v2 = element_val(nf,(GEN)p1[2],pr); tau = (v1 > v2)? (GEN)p1[2]: (GEN)p1[1]; tauinv = element_inv(nf, tau); Tau[j] = (long)tau; Tauinv[j] = (long)tauinv; W[j] = (long)element_mulvec(nf, tau, (GEN)W[j]); I[j] = (long)idealmul(nf, tauinv, (GEN)I[j]); } /* W = (Z_K/pr)-basis of O/pr. O = (W0,I0) ~ (W, I) */ Wa = basistoalg(nf,W); /* compute MW: W_i*W_j = sum MW_k,(i,j) W_k */ Waa = lift_intern(mat_to_vecpol(Wa,vpol)); Wainv = lift_intern(ginv(Wa)); for (i=1; i<=n; i++) for (j=i; j<=n; j++) { GEN z = RXQX_rem(gmul((GEN)Waa[i],(GEN)Waa[j]), pol, nfT); long tz = typ(z); if (is_scalar_t(tz) || (tz == t_POL && varn(z) > vpol)) z = gmul(z, (GEN)Wainv[1]); else z = mulmat_pol(Wainv, z); for (k=1; k<=n; k++) { GEN c = gres((GEN)z[k], nfT); coeff(MW, k, (i-1)*n+j) = (long)c; coeff(MW, k, (j-1)*n+i) = (long)c; } } /* compute Ip = pr-radical [ could use Ker(trace) if q large ] */ MWmod = modprM(MW,nf,modpr); F = cgetg(n+1, t_MAT); F[1] = rnfId[1]; for (j=2; j<=n; j++) F[j] = (long)rnfelementid_powmod(MWmod, j, q1, T,p); Ip = FqM_ker(F,T,p); /* Fill C: W_k A_j = sum_i C_(i,j),k A_i */ if (lg(Ip) == 1) A = rnfId; else A = modprM_lift(FqM_suppl(Ip,T,p), modpr); for (j=1; j<lg(Ip); j++) { p1 = (GEN)A[j]; for (i=1; i<=n; i++) p1[i] = (long)to_polmod((GEN)p1[i], nfT); } for ( ; j<=n; j++) { p1 = (GEN)A[j]; for (i=1; i<=n; i++) p1[i] = lmul(pip, (GEN)p1[i]); } Ainv = lift_intern(ginv(A)); A = lift_intern(A); for (k=1; k<=n; k++) for (j=1; j<=n; j++) { GEN z = gmul(Ainv, gmod(element_mulid(MW, (GEN)A[j],k), nfT)); for (i=1; i<=n; i++) { GEN c = gres((GEN)z[i], nfT); coeff(C, (j-1)*n+i, k) = (long)nf_to_ff(nf,c,modpr); } } G = modprM_lift(FqM_ker(C,T,p), modpr); pseudo = rnfjoinmodules_i(nf, G,prhinv, rnfId,I); /* express W in terms of the power basis */ W = algtobasis(nf, gmul(Wa, basistoalg(nf,(GEN)pseudo[1]))); I = (GEN)pseudo[2]; /* restore the HNF property W[i,i] = 1. NB: Wa upper triangular, with * Wa[i,i] = Tau[i] */ for (j=1; j<=n; j++) if (Tau[j] != un) { W[j] = (long)element_mulvec(nf, (GEN)Tauinv[j], (GEN)W[j]); I[j] = (long)idealmul(nf, (GEN)Tau[j], (GEN)I[j] ); } if (DEBUGLEVEL>3) fprintferr(" new order:\n%Z\n%Z\n", W, I); if (sep <= 3 || gegal(I,I0)) { GEN res = cgetg(3,t_VEC); res[1] = (long)W; res[2] = (long)I; return gerepilecopy(av, res); } if (low_stack(lim, stack_lim(av1,1)) || (cmpt & 3) == 0) { if(DEBUGMEM>1) err(warnmem,"rnfordmax"); gerepileall(av1,2, &W,&I); } }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/530224b821f2d636c09a13003425f3f91b767fb4/base2.c/clean/src/basemath/base2.c |
if (lg(Ip) == 1) A = rnfId; else A = modprM_lift(FqM_suppl(Ip,T,p), modpr); | A = modprM_lift(FqM_suppl(Ip,T,p), modpr); | rnfordmax(GEN nf, GEN pol, GEN pr, long vdisc){ pari_sp av = avma, av1, lim; long i, j, k, n, vpol, cmpt, sep; GEN q, q1, p, T, modpr, W, I, MW, C, p1; GEN Tauinv, Tau, prhinv, pip, nfT, id, rnfId; if (DEBUGLEVEL>1) fprintferr(" treating %Z\n",pr); modpr = nf_to_ff_init(nf,&pr,&T,&p); p1 = rnfdedekind_i(nf, pol, modpr, vdisc); if (!p1) { avma = av; return NULL; } if (gcmp1((GEN)p1[1])) return gerepilecopy(av,(GEN)p1[2]); sep = itos((GEN)p1[3]); W = gmael(p1,2,1); I = gmael(p1,2,2); pip = basistoalg(nf, (GEN)pr[2]); nfT = (GEN)nf[1]; n = degpol(pol); vpol = varn(pol); q = T? gpowgs(p,degpol(T)): p; q1 = q; while (cmpis(q1,n) < 0) q1 = mulii(q1,q); rnfId = idmat(n); id = idmat(degpol(nfT)); prhinv = idealinv(nf, pr); C = cgetg(n+1, t_MAT); for (j=1; j<=n; j++) C[j] = lgetg(n*n+1, t_COL); MW = cgetg(n*n+1, t_MAT); for (j=1; j<=n*n; j++) MW[j] = lgetg(n+1, t_COL); Tauinv = cgetg(n+1, t_VEC); Tau = cgetg(n+1, t_VEC); av1 = avma; lim = stack_lim(av1,1); for(cmpt=1; ; cmpt++) { GEN I0 = dummycopy(I), Wa; GEN Wainv, Waa; GEN Ip, A, Ainv, MWmod, F; GEN pseudo, G; if (DEBUGLEVEL>1) fprintferr(" %ld%s pass\n",cmpt,eng_ord(cmpt)); for (j=1; j<=n; j++) { GEN tau, tauinv; long v1, v2; if (gegal((GEN)I[j],id)) { Tau[j] = Tauinv[j] = un; continue; } p1 = ideal_two_elt(nf,(GEN)I[j]); v1 = element_val(nf,(GEN)p1[1],pr); v2 = element_val(nf,(GEN)p1[2],pr); tau = (v1 > v2)? (GEN)p1[2]: (GEN)p1[1]; tauinv = element_inv(nf, tau); Tau[j] = (long)tau; Tauinv[j] = (long)tauinv; W[j] = (long)element_mulvec(nf, tau, (GEN)W[j]); I[j] = (long)idealmul(nf, tauinv, (GEN)I[j]); } /* W = (Z_K/pr)-basis of O/pr. O = (W0,I0) ~ (W, I) */ Wa = basistoalg(nf,W); /* compute MW: W_i*W_j = sum MW_k,(i,j) W_k */ Waa = lift_intern(mat_to_vecpol(Wa,vpol)); Wainv = lift_intern(ginv(Wa)); for (i=1; i<=n; i++) for (j=i; j<=n; j++) { GEN z = RXQX_rem(gmul((GEN)Waa[i],(GEN)Waa[j]), pol, nfT); long tz = typ(z); if (is_scalar_t(tz) || (tz == t_POL && varn(z) > vpol)) z = gmul(z, (GEN)Wainv[1]); else z = mulmat_pol(Wainv, z); for (k=1; k<=n; k++) { GEN c = gres((GEN)z[k], nfT); coeff(MW, k, (i-1)*n+j) = (long)c; coeff(MW, k, (j-1)*n+i) = (long)c; } } /* compute Ip = pr-radical [ could use Ker(trace) if q large ] */ MWmod = modprM(MW,nf,modpr); F = cgetg(n+1, t_MAT); F[1] = rnfId[1]; for (j=2; j<=n; j++) F[j] = (long)rnfelementid_powmod(MWmod, j, q1, T,p); Ip = FqM_ker(F,T,p); /* Fill C: W_k A_j = sum_i C_(i,j),k A_i */ if (lg(Ip) == 1) A = rnfId; else A = modprM_lift(FqM_suppl(Ip,T,p), modpr); for (j=1; j<lg(Ip); j++) { p1 = (GEN)A[j]; for (i=1; i<=n; i++) p1[i] = (long)to_polmod((GEN)p1[i], nfT); } for ( ; j<=n; j++) { p1 = (GEN)A[j]; for (i=1; i<=n; i++) p1[i] = lmul(pip, (GEN)p1[i]); } Ainv = lift_intern(ginv(A)); A = lift_intern(A); for (k=1; k<=n; k++) for (j=1; j<=n; j++) { GEN z = gmul(Ainv, gmod(element_mulid(MW, (GEN)A[j],k), nfT)); for (i=1; i<=n; i++) { GEN c = gres((GEN)z[i], nfT); coeff(C, (j-1)*n+i, k) = (long)nf_to_ff(nf,c,modpr); } } G = modprM_lift(FqM_ker(C,T,p), modpr); pseudo = rnfjoinmodules_i(nf, G,prhinv, rnfId,I); /* express W in terms of the power basis */ W = algtobasis(nf, gmul(Wa, basistoalg(nf,(GEN)pseudo[1]))); I = (GEN)pseudo[2]; /* restore the HNF property W[i,i] = 1. NB: Wa upper triangular, with * Wa[i,i] = Tau[i] */ for (j=1; j<=n; j++) if (Tau[j] != un) { W[j] = (long)element_mulvec(nf, (GEN)Tauinv[j], (GEN)W[j]); I[j] = (long)idealmul(nf, (GEN)Tau[j], (GEN)I[j] ); } if (DEBUGLEVEL>3) fprintferr(" new order:\n%Z\n%Z\n", W, I); if (sep <= 3 || gegal(I,I0)) { GEN res = cgetg(3,t_VEC); res[1] = (long)W; res[2] = (long)I; return gerepilecopy(av, res); } if (low_stack(lim, stack_lim(av1,1)) || (cmpt & 3) == 0) { if(DEBUGMEM>1) err(warnmem,"rnfordmax"); gerepileall(av1,2, &W,&I); } }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/530224b821f2d636c09a13003425f3f91b767fb4/base2.c/clean/src/basemath/base2.c |
G = modprM_lift(FqM_ker(C,T,p), modpr); | rnfordmax(GEN nf, GEN pol, GEN pr, long vdisc){ pari_sp av = avma, av1, lim; long i, j, k, n, vpol, cmpt, sep; GEN q, q1, p, T, modpr, W, I, MW, C, p1; GEN Tauinv, Tau, prhinv, pip, nfT, id, rnfId; if (DEBUGLEVEL>1) fprintferr(" treating %Z\n",pr); modpr = nf_to_ff_init(nf,&pr,&T,&p); p1 = rnfdedekind_i(nf, pol, modpr, vdisc); if (!p1) { avma = av; return NULL; } if (gcmp1((GEN)p1[1])) return gerepilecopy(av,(GEN)p1[2]); sep = itos((GEN)p1[3]); W = gmael(p1,2,1); I = gmael(p1,2,2); pip = basistoalg(nf, (GEN)pr[2]); nfT = (GEN)nf[1]; n = degpol(pol); vpol = varn(pol); q = T? gpowgs(p,degpol(T)): p; q1 = q; while (cmpis(q1,n) < 0) q1 = mulii(q1,q); rnfId = idmat(n); id = idmat(degpol(nfT)); prhinv = idealinv(nf, pr); C = cgetg(n+1, t_MAT); for (j=1; j<=n; j++) C[j] = lgetg(n*n+1, t_COL); MW = cgetg(n*n+1, t_MAT); for (j=1; j<=n*n; j++) MW[j] = lgetg(n+1, t_COL); Tauinv = cgetg(n+1, t_VEC); Tau = cgetg(n+1, t_VEC); av1 = avma; lim = stack_lim(av1,1); for(cmpt=1; ; cmpt++) { GEN I0 = dummycopy(I), Wa; GEN Wainv, Waa; GEN Ip, A, Ainv, MWmod, F; GEN pseudo, G; if (DEBUGLEVEL>1) fprintferr(" %ld%s pass\n",cmpt,eng_ord(cmpt)); for (j=1; j<=n; j++) { GEN tau, tauinv; long v1, v2; if (gegal((GEN)I[j],id)) { Tau[j] = Tauinv[j] = un; continue; } p1 = ideal_two_elt(nf,(GEN)I[j]); v1 = element_val(nf,(GEN)p1[1],pr); v2 = element_val(nf,(GEN)p1[2],pr); tau = (v1 > v2)? (GEN)p1[2]: (GEN)p1[1]; tauinv = element_inv(nf, tau); Tau[j] = (long)tau; Tauinv[j] = (long)tauinv; W[j] = (long)element_mulvec(nf, tau, (GEN)W[j]); I[j] = (long)idealmul(nf, tauinv, (GEN)I[j]); } /* W = (Z_K/pr)-basis of O/pr. O = (W0,I0) ~ (W, I) */ Wa = basistoalg(nf,W); /* compute MW: W_i*W_j = sum MW_k,(i,j) W_k */ Waa = lift_intern(mat_to_vecpol(Wa,vpol)); Wainv = lift_intern(ginv(Wa)); for (i=1; i<=n; i++) for (j=i; j<=n; j++) { GEN z = RXQX_rem(gmul((GEN)Waa[i],(GEN)Waa[j]), pol, nfT); long tz = typ(z); if (is_scalar_t(tz) || (tz == t_POL && varn(z) > vpol)) z = gmul(z, (GEN)Wainv[1]); else z = mulmat_pol(Wainv, z); for (k=1; k<=n; k++) { GEN c = gres((GEN)z[k], nfT); coeff(MW, k, (i-1)*n+j) = (long)c; coeff(MW, k, (j-1)*n+i) = (long)c; } } /* compute Ip = pr-radical [ could use Ker(trace) if q large ] */ MWmod = modprM(MW,nf,modpr); F = cgetg(n+1, t_MAT); F[1] = rnfId[1]; for (j=2; j<=n; j++) F[j] = (long)rnfelementid_powmod(MWmod, j, q1, T,p); Ip = FqM_ker(F,T,p); /* Fill C: W_k A_j = sum_i C_(i,j),k A_i */ if (lg(Ip) == 1) A = rnfId; else A = modprM_lift(FqM_suppl(Ip,T,p), modpr); for (j=1; j<lg(Ip); j++) { p1 = (GEN)A[j]; for (i=1; i<=n; i++) p1[i] = (long)to_polmod((GEN)p1[i], nfT); } for ( ; j<=n; j++) { p1 = (GEN)A[j]; for (i=1; i<=n; i++) p1[i] = lmul(pip, (GEN)p1[i]); } Ainv = lift_intern(ginv(A)); A = lift_intern(A); for (k=1; k<=n; k++) for (j=1; j<=n; j++) { GEN z = gmul(Ainv, gmod(element_mulid(MW, (GEN)A[j],k), nfT)); for (i=1; i<=n; i++) { GEN c = gres((GEN)z[i], nfT); coeff(C, (j-1)*n+i, k) = (long)nf_to_ff(nf,c,modpr); } } G = modprM_lift(FqM_ker(C,T,p), modpr); pseudo = rnfjoinmodules_i(nf, G,prhinv, rnfId,I); /* express W in terms of the power basis */ W = algtobasis(nf, gmul(Wa, basistoalg(nf,(GEN)pseudo[1]))); I = (GEN)pseudo[2]; /* restore the HNF property W[i,i] = 1. NB: Wa upper triangular, with * Wa[i,i] = Tau[i] */ for (j=1; j<=n; j++) if (Tau[j] != un) { W[j] = (long)element_mulvec(nf, (GEN)Tauinv[j], (GEN)W[j]); I[j] = (long)idealmul(nf, (GEN)Tau[j], (GEN)I[j] ); } if (DEBUGLEVEL>3) fprintferr(" new order:\n%Z\n%Z\n", W, I); if (sep <= 3 || gegal(I,I0)) { GEN res = cgetg(3,t_VEC); res[1] = (long)W; res[2] = (long)I; return gerepilecopy(av, res); } if (low_stack(lim, stack_lim(av1,1)) || (cmpt & 3) == 0) { if(DEBUGMEM>1) err(warnmem,"rnfordmax"); gerepileall(av1,2, &W,&I); } }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/530224b821f2d636c09a13003425f3f91b767fb4/base2.c/clean/src/basemath/base2.c |
|
if (sep <= 3 || gegal(I,I0)) { GEN res = cgetg(3,t_VEC); res[1] = (long)W; res[2] = (long)I; return gerepilecopy(av, res); } | if (sep <= 3 || gegal(I,I0)) break; | rnfordmax(GEN nf, GEN pol, GEN pr, long vdisc){ pari_sp av = avma, av1, lim; long i, j, k, n, vpol, cmpt, sep; GEN q, q1, p, T, modpr, W, I, MW, C, p1; GEN Tauinv, Tau, prhinv, pip, nfT, id, rnfId; if (DEBUGLEVEL>1) fprintferr(" treating %Z\n",pr); modpr = nf_to_ff_init(nf,&pr,&T,&p); p1 = rnfdedekind_i(nf, pol, modpr, vdisc); if (!p1) { avma = av; return NULL; } if (gcmp1((GEN)p1[1])) return gerepilecopy(av,(GEN)p1[2]); sep = itos((GEN)p1[3]); W = gmael(p1,2,1); I = gmael(p1,2,2); pip = basistoalg(nf, (GEN)pr[2]); nfT = (GEN)nf[1]; n = degpol(pol); vpol = varn(pol); q = T? gpowgs(p,degpol(T)): p; q1 = q; while (cmpis(q1,n) < 0) q1 = mulii(q1,q); rnfId = idmat(n); id = idmat(degpol(nfT)); prhinv = idealinv(nf, pr); C = cgetg(n+1, t_MAT); for (j=1; j<=n; j++) C[j] = lgetg(n*n+1, t_COL); MW = cgetg(n*n+1, t_MAT); for (j=1; j<=n*n; j++) MW[j] = lgetg(n+1, t_COL); Tauinv = cgetg(n+1, t_VEC); Tau = cgetg(n+1, t_VEC); av1 = avma; lim = stack_lim(av1,1); for(cmpt=1; ; cmpt++) { GEN I0 = dummycopy(I), Wa; GEN Wainv, Waa; GEN Ip, A, Ainv, MWmod, F; GEN pseudo, G; if (DEBUGLEVEL>1) fprintferr(" %ld%s pass\n",cmpt,eng_ord(cmpt)); for (j=1; j<=n; j++) { GEN tau, tauinv; long v1, v2; if (gegal((GEN)I[j],id)) { Tau[j] = Tauinv[j] = un; continue; } p1 = ideal_two_elt(nf,(GEN)I[j]); v1 = element_val(nf,(GEN)p1[1],pr); v2 = element_val(nf,(GEN)p1[2],pr); tau = (v1 > v2)? (GEN)p1[2]: (GEN)p1[1]; tauinv = element_inv(nf, tau); Tau[j] = (long)tau; Tauinv[j] = (long)tauinv; W[j] = (long)element_mulvec(nf, tau, (GEN)W[j]); I[j] = (long)idealmul(nf, tauinv, (GEN)I[j]); } /* W = (Z_K/pr)-basis of O/pr. O = (W0,I0) ~ (W, I) */ Wa = basistoalg(nf,W); /* compute MW: W_i*W_j = sum MW_k,(i,j) W_k */ Waa = lift_intern(mat_to_vecpol(Wa,vpol)); Wainv = lift_intern(ginv(Wa)); for (i=1; i<=n; i++) for (j=i; j<=n; j++) { GEN z = RXQX_rem(gmul((GEN)Waa[i],(GEN)Waa[j]), pol, nfT); long tz = typ(z); if (is_scalar_t(tz) || (tz == t_POL && varn(z) > vpol)) z = gmul(z, (GEN)Wainv[1]); else z = mulmat_pol(Wainv, z); for (k=1; k<=n; k++) { GEN c = gres((GEN)z[k], nfT); coeff(MW, k, (i-1)*n+j) = (long)c; coeff(MW, k, (j-1)*n+i) = (long)c; } } /* compute Ip = pr-radical [ could use Ker(trace) if q large ] */ MWmod = modprM(MW,nf,modpr); F = cgetg(n+1, t_MAT); F[1] = rnfId[1]; for (j=2; j<=n; j++) F[j] = (long)rnfelementid_powmod(MWmod, j, q1, T,p); Ip = FqM_ker(F,T,p); /* Fill C: W_k A_j = sum_i C_(i,j),k A_i */ if (lg(Ip) == 1) A = rnfId; else A = modprM_lift(FqM_suppl(Ip,T,p), modpr); for (j=1; j<lg(Ip); j++) { p1 = (GEN)A[j]; for (i=1; i<=n; i++) p1[i] = (long)to_polmod((GEN)p1[i], nfT); } for ( ; j<=n; j++) { p1 = (GEN)A[j]; for (i=1; i<=n; i++) p1[i] = lmul(pip, (GEN)p1[i]); } Ainv = lift_intern(ginv(A)); A = lift_intern(A); for (k=1; k<=n; k++) for (j=1; j<=n; j++) { GEN z = gmul(Ainv, gmod(element_mulid(MW, (GEN)A[j],k), nfT)); for (i=1; i<=n; i++) { GEN c = gres((GEN)z[i], nfT); coeff(C, (j-1)*n+i, k) = (long)nf_to_ff(nf,c,modpr); } } G = modprM_lift(FqM_ker(C,T,p), modpr); pseudo = rnfjoinmodules_i(nf, G,prhinv, rnfId,I); /* express W in terms of the power basis */ W = algtobasis(nf, gmul(Wa, basistoalg(nf,(GEN)pseudo[1]))); I = (GEN)pseudo[2]; /* restore the HNF property W[i,i] = 1. NB: Wa upper triangular, with * Wa[i,i] = Tau[i] */ for (j=1; j<=n; j++) if (Tau[j] != un) { W[j] = (long)element_mulvec(nf, (GEN)Tauinv[j], (GEN)W[j]); I[j] = (long)idealmul(nf, (GEN)Tau[j], (GEN)I[j] ); } if (DEBUGLEVEL>3) fprintferr(" new order:\n%Z\n%Z\n", W, I); if (sep <= 3 || gegal(I,I0)) { GEN res = cgetg(3,t_VEC); res[1] = (long)W; res[2] = (long)I; return gerepilecopy(av, res); } if (low_stack(lim, stack_lim(av1,1)) || (cmpt & 3) == 0) { if(DEBUGMEM>1) err(warnmem,"rnfordmax"); gerepileall(av1,2, &W,&I); } }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/530224b821f2d636c09a13003425f3f91b767fb4/base2.c/clean/src/basemath/base2.c |
{ GEN res = cgetg(3,t_VEC); res[1] = (long)W; res[2] = (long)I; return gerepilecopy(av, res); } | rnfordmax(GEN nf, GEN pol, GEN pr, long vdisc){ pari_sp av = avma, av1, lim; long i, j, k, n, vpol, cmpt, sep; GEN q, q1, p, T, modpr, W, I, MW, C, p1; GEN Tauinv, Tau, prhinv, pip, nfT, id, rnfId; if (DEBUGLEVEL>1) fprintferr(" treating %Z\n",pr); modpr = nf_to_ff_init(nf,&pr,&T,&p); p1 = rnfdedekind_i(nf, pol, modpr, vdisc); if (!p1) { avma = av; return NULL; } if (gcmp1((GEN)p1[1])) return gerepilecopy(av,(GEN)p1[2]); sep = itos((GEN)p1[3]); W = gmael(p1,2,1); I = gmael(p1,2,2); pip = basistoalg(nf, (GEN)pr[2]); nfT = (GEN)nf[1]; n = degpol(pol); vpol = varn(pol); q = T? gpowgs(p,degpol(T)): p; q1 = q; while (cmpis(q1,n) < 0) q1 = mulii(q1,q); rnfId = idmat(n); id = idmat(degpol(nfT)); prhinv = idealinv(nf, pr); C = cgetg(n+1, t_MAT); for (j=1; j<=n; j++) C[j] = lgetg(n*n+1, t_COL); MW = cgetg(n*n+1, t_MAT); for (j=1; j<=n*n; j++) MW[j] = lgetg(n+1, t_COL); Tauinv = cgetg(n+1, t_VEC); Tau = cgetg(n+1, t_VEC); av1 = avma; lim = stack_lim(av1,1); for(cmpt=1; ; cmpt++) { GEN I0 = dummycopy(I), Wa; GEN Wainv, Waa; GEN Ip, A, Ainv, MWmod, F; GEN pseudo, G; if (DEBUGLEVEL>1) fprintferr(" %ld%s pass\n",cmpt,eng_ord(cmpt)); for (j=1; j<=n; j++) { GEN tau, tauinv; long v1, v2; if (gegal((GEN)I[j],id)) { Tau[j] = Tauinv[j] = un; continue; } p1 = ideal_two_elt(nf,(GEN)I[j]); v1 = element_val(nf,(GEN)p1[1],pr); v2 = element_val(nf,(GEN)p1[2],pr); tau = (v1 > v2)? (GEN)p1[2]: (GEN)p1[1]; tauinv = element_inv(nf, tau); Tau[j] = (long)tau; Tauinv[j] = (long)tauinv; W[j] = (long)element_mulvec(nf, tau, (GEN)W[j]); I[j] = (long)idealmul(nf, tauinv, (GEN)I[j]); } /* W = (Z_K/pr)-basis of O/pr. O = (W0,I0) ~ (W, I) */ Wa = basistoalg(nf,W); /* compute MW: W_i*W_j = sum MW_k,(i,j) W_k */ Waa = lift_intern(mat_to_vecpol(Wa,vpol)); Wainv = lift_intern(ginv(Wa)); for (i=1; i<=n; i++) for (j=i; j<=n; j++) { GEN z = RXQX_rem(gmul((GEN)Waa[i],(GEN)Waa[j]), pol, nfT); long tz = typ(z); if (is_scalar_t(tz) || (tz == t_POL && varn(z) > vpol)) z = gmul(z, (GEN)Wainv[1]); else z = mulmat_pol(Wainv, z); for (k=1; k<=n; k++) { GEN c = gres((GEN)z[k], nfT); coeff(MW, k, (i-1)*n+j) = (long)c; coeff(MW, k, (j-1)*n+i) = (long)c; } } /* compute Ip = pr-radical [ could use Ker(trace) if q large ] */ MWmod = modprM(MW,nf,modpr); F = cgetg(n+1, t_MAT); F[1] = rnfId[1]; for (j=2; j<=n; j++) F[j] = (long)rnfelementid_powmod(MWmod, j, q1, T,p); Ip = FqM_ker(F,T,p); /* Fill C: W_k A_j = sum_i C_(i,j),k A_i */ if (lg(Ip) == 1) A = rnfId; else A = modprM_lift(FqM_suppl(Ip,T,p), modpr); for (j=1; j<lg(Ip); j++) { p1 = (GEN)A[j]; for (i=1; i<=n; i++) p1[i] = (long)to_polmod((GEN)p1[i], nfT); } for ( ; j<=n; j++) { p1 = (GEN)A[j]; for (i=1; i<=n; i++) p1[i] = lmul(pip, (GEN)p1[i]); } Ainv = lift_intern(ginv(A)); A = lift_intern(A); for (k=1; k<=n; k++) for (j=1; j<=n; j++) { GEN z = gmul(Ainv, gmod(element_mulid(MW, (GEN)A[j],k), nfT)); for (i=1; i<=n; i++) { GEN c = gres((GEN)z[i], nfT); coeff(C, (j-1)*n+i, k) = (long)nf_to_ff(nf,c,modpr); } } G = modprM_lift(FqM_ker(C,T,p), modpr); pseudo = rnfjoinmodules_i(nf, G,prhinv, rnfId,I); /* express W in terms of the power basis */ W = algtobasis(nf, gmul(Wa, basistoalg(nf,(GEN)pseudo[1]))); I = (GEN)pseudo[2]; /* restore the HNF property W[i,i] = 1. NB: Wa upper triangular, with * Wa[i,i] = Tau[i] */ for (j=1; j<=n; j++) if (Tau[j] != un) { W[j] = (long)element_mulvec(nf, (GEN)Tauinv[j], (GEN)W[j]); I[j] = (long)idealmul(nf, (GEN)Tau[j], (GEN)I[j] ); } if (DEBUGLEVEL>3) fprintferr(" new order:\n%Z\n%Z\n", W, I); if (sep <= 3 || gegal(I,I0)) { GEN res = cgetg(3,t_VEC); res[1] = (long)W; res[2] = (long)I; return gerepilecopy(av, res); } if (low_stack(lim, stack_lim(av1,1)) || (cmpt & 3) == 0) { if(DEBUGMEM>1) err(warnmem,"rnfordmax"); gerepileall(av1,2, &W,&I); } }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/530224b821f2d636c09a13003425f3f91b767fb4/base2.c/clean/src/basemath/base2.c |
|
flush_cache(); | rtems_flush_entire_data_cache(); | void _CPU_disable_paging() { cr0 regCr0; flush_cache(); regCr0.i = i386_get_cr0(); regCr0.cr0.paging = 0; i386_set_cr0( regCr0.i );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/8ef38186faea3d9b5e6f0f1242f668cb7e7a3d52/page.c/clean/c/src/lib/libcpu/i386/page.c |
/* * RTEMS additions for setting/getting `tap' function */ case SIOCSIFTAP: ifp->if_tap = ifr->ifr_tap; return 0; case SIOCGIFTAP: ifr->ifr_tap = ifp->if_tap; return 0; | ifioctl(so, cmd, data, p) struct socket *so; int cmd; caddr_t data; struct proc *p;{ register struct ifnet *ifp; register struct ifreq *ifr; int error; switch (cmd) { case SIOCGIFCONF: case OSIOCGIFCONF: return (ifconf(cmd, data)); } ifr = (struct ifreq *)data; ifp = ifunit(ifr->ifr_name); if (ifp == 0) return (ENXIO); switch (cmd) { case SIOCGIFFLAGS: ifr->ifr_flags = ifp->if_flags; break; case SIOCGIFMETRIC: ifr->ifr_metric = ifp->if_metric; break; case SIOCGIFMTU: ifr->ifr_mtu = ifp->if_mtu; break; case SIOCGIFPHYS: ifr->ifr_phys = ifp->if_physical; break; case SIOCSIFFLAGS: error = suser(p->p_ucred, &p->p_acflag); if (error) return (error); if (ifp->if_flags & IFF_UP && (ifr->ifr_flags & IFF_UP) == 0) { int s = splimp(); if_down(ifp); splx(s); } if (ifr->ifr_flags & IFF_UP && (ifp->if_flags & IFF_UP) == 0) { int s = splimp(); if_up(ifp); splx(s); } ifp->if_flags = (ifp->if_flags & IFF_CANTCHANGE) | (ifr->ifr_flags &~ IFF_CANTCHANGE); if (ifp->if_ioctl) (void) (*ifp->if_ioctl)(ifp, cmd, data); microtime(&ifp->if_lastchange); break; case SIOCSIFMETRIC: error = suser(p->p_ucred, &p->p_acflag); if (error) return (error); ifp->if_metric = ifr->ifr_metric; microtime(&ifp->if_lastchange); break; case SIOCSIFPHYS: error = suser(p->p_ucred, &p->p_acflag); if (error) return error; if (!ifp->if_ioctl) return EOPNOTSUPP; error = (*ifp->if_ioctl)(ifp, cmd, data); if (error == 0) microtime(&ifp->if_lastchange); return(error); case SIOCSIFMTU: error = suser(p->p_ucred, &p->p_acflag); if (error) return (error); if (ifp->if_ioctl == NULL) return (EOPNOTSUPP); /* * 72 was chosen below because it is the size of a TCP/IP * header (40) + the minimum mss (32). */ if (ifr->ifr_mtu < 72 || ifr->ifr_mtu > 65535) return (EINVAL); error = (*ifp->if_ioctl)(ifp, cmd, data); if (error == 0) microtime(&ifp->if_lastchange); return(error); case SIOCADDMULTI: case SIOCDELMULTI: error = suser(p->p_ucred, &p->p_acflag); if (error) return (error); if (ifp->if_ioctl == NULL) return (EOPNOTSUPP); error = (*ifp->if_ioctl)(ifp, cmd, data); if (error == 0 ) microtime(&ifp->if_lastchange); return(error); case SIOCSIFMEDIA: error = suser(p->p_ucred, &p->p_acflag); if (error) return (error); if (ifp->if_ioctl == 0) return (EOPNOTSUPP); error = (*ifp->if_ioctl)(ifp, cmd, data); if (error == 0) microtime(&ifp->if_lastchange); return error; case SIOCGIFMEDIA: if (ifp->if_ioctl == 0) return (EOPNOTSUPP); return ((*ifp->if_ioctl)(ifp, cmd, data)); default: if (so->so_proto == 0) return (EOPNOTSUPP);#ifndef COMPAT_43 return ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, data, ifp));#else { int ocmd = cmd; switch (cmd) { case SIOCSIFDSTADDR: case SIOCSIFADDR: case SIOCSIFBRDADDR: case SIOCSIFNETMASK:#if BYTE_ORDER != BIG_ENDIAN if (ifr->ifr_addr.sa_family == 0 && ifr->ifr_addr.sa_len < 16) { ifr->ifr_addr.sa_family = ifr->ifr_addr.sa_len; ifr->ifr_addr.sa_len = 16; }#else if (ifr->ifr_addr.sa_len == 0) ifr->ifr_addr.sa_len = 16;#endif break; case OSIOCGIFADDR: cmd = SIOCGIFADDR; break; case OSIOCGIFDSTADDR: cmd = SIOCGIFDSTADDR; break; case OSIOCGIFBRDADDR: cmd = SIOCGIFBRDADDR; break; case OSIOCGIFNETMASK: cmd = SIOCGIFNETMASK; } error = ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, data, ifp)); switch (ocmd) { case OSIOCGIFADDR: case OSIOCGIFDSTADDR: case OSIOCGIFBRDADDR: case OSIOCGIFNETMASK: *(u_short *)&ifr->ifr_addr = ifr->ifr_addr.sa_family; } return (error); }#endif } return (0);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/a3d0b8a79a432820dee80b1583f1acf86d256e97/if.c/buggy/c/src/lib/libnetworking/net/if.c |
|
size = (long) (1.09 * maxnum/log((double)maxnum)) + 145; | size = (long) (1.09 * maxnum/log((double)maxnum)) + 146; | initprimes0(ulong maxnum, long *lenp, ulong *lastp){ long size, alloced, psize; byteptr q, fin, p, p1, fin1, plast, curdiff; ulong last, remains, curlow, rootnum, asize; ulong prime_above = 3; byteptr p_prime_above; if (maxnum <= 1ul<<17) /* Arbitrary. */ return initprimes1(maxnum>>1, lenp, (long*)lastp); /* Break recursion */ maxnum |= 1; /* make it odd. */ /* Checked to be enough up to 40e6, attained at 155893 */ /* Due to multibyte representation of large gaps, this estimate will be broken by large enough maxnum. However, assuming exponential distribution of gaps with the average log(n), we are safe up to circa exp(-256/log(1/0.09)) = 1.5e46. OK with LONG_BITS <= 128. ;-) */ size = (long) (1.09 * maxnum/log((double)maxnum)) + 145; p1 = (byteptr) gpmalloc(size); rootnum = (ulong) sqrt((double)maxnum); /* cast it back to a long */ rootnum |= 1; { byteptr p2 = initprimes0(rootnum, &psize, &last); /* recursive call */ memcpy(p1, p2, psize); free(p2); } fin1 = p1 + psize - 1; remains = (maxnum - rootnum) >> 1; /* number of odd numbers to check */ /* Actually, we access primes array of psize too; but we access it consequently, thus we do not include it in fixed_to_cache */ asize = good_arena_size((ulong)(rootnum * slow2_in_roots), remains + 1, 0, &cache_model, 0) - 1; /* enough room on the stack ? */ alloced = (((byteptr)avma) <= ((byteptr)bot) + asize); if (alloced) p = (byteptr) gpmalloc(asize + 1); else p = (byteptr) bot; fin = p + asize; /* the 0 sentinel goes at fin. */ curlow = rootnum + 2; /* First candidate: know primes up to rootnum (odd). */ curdiff = fin1; /* During each iteration p..fin-1 represents a range of odd numbers. plast is a pointer which represents the last prime seen, it may point before p..fin-1. */ plast = p - ((rootnum - last) >> 1) - 1; p_prime_above = p1 + 2; while (remains) /* Cycle over arenas. Performance is not crucial */ { unsigned char was_delta; if (asize > remains) { asize = remains; fin = p + asize; } /* Fake the upper limit appropriate for the given arena */ while (prime_above*prime_above <= curlow + (asize << 1) && *p_prime_above) prime_above += *p_prime_above++; was_delta = *p_prime_above; *p_prime_above = 0; /* Put a 0 sentinel for sieve_chunk */ (*sieve_chunk_p)(p1, curlow, p, asize); *p_prime_above = was_delta; /* Restore */ p[asize] = 0; /* Put a 0 sentinel for ZZZ */ /* now q runs over addresses corresponding to primes */ for (q = p; ; plast = q++) { long d; while (*q) q++; /* use ZZZ 0-sentinel at end */ if (q >= fin) break; d = (q - plast) << 1; while (d >= DIFFPTR_SKIP) *curdiff++ = DIFFPTR_SKIP, d -= DIFFPTR_SKIP; *curdiff++ = (unsigned char)d; } plast -= asize; remains -= asize; curlow += (asize<<1); } /* while (remains) */ last = curlow - ((p - plast) << 1); *curdiff++ = 0; /* sentinel */ *lenp = curdiff - p1; *lastp = last; if (alloced) free(p); return (byteptr) gprealloc(p1, *lenp);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/d1010643aeaea8533c61adf620f8f01cbd901a9e/arith2.c/buggy/src/basemath/arith2.c |
GEN N, P, M, d = qf_disc(Q); | GEN N, P, P1, P2, M, d = qf_disc(Q); | qfbrealsolvep(GEN Q, GEN p){ pari_sp ltop = avma, btop, st_lim; GEN N, P, M, d = qf_disc(Q); if (kronecker(d, p) < 0) { avma = ltop; return gen_0; } N = redrealsl2(Q); P = primeform(d, p, DEFAULTPREC); gel(P,2) = negi(gel(P,2));/*This form leads to a smaller solution*/ P = M = redrealsl2(P); btop = avma; st_lim = stack_lim(btop, 1); while (!gequal(gel(M,1), gel(N,1))) { M = redrealsl2step(M); if (gequal(gel(M,1), gel(P,1))) { avma = ltop; return gen_0; } if (low_stack(st_lim, stack_lim(btop, 1))) M = gerepileupto(btop, M); } return gerepilecopy(ltop, SL2_div_mul_e1(gel(N,2),gel(M,2)));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/483d59e20c9966bdd012e7e829be1b438419faa8/Qfb.c/clean/src/basemath/Qfb.c |
N = redrealsl2(Q); | M = N = redrealsl2(Q); | qfbrealsolvep(GEN Q, GEN p){ pari_sp ltop = avma, btop, st_lim; GEN N, P, M, d = qf_disc(Q); if (kronecker(d, p) < 0) { avma = ltop; return gen_0; } N = redrealsl2(Q); P = primeform(d, p, DEFAULTPREC); gel(P,2) = negi(gel(P,2));/*This form leads to a smaller solution*/ P = M = redrealsl2(P); btop = avma; st_lim = stack_lim(btop, 1); while (!gequal(gel(M,1), gel(N,1))) { M = redrealsl2step(M); if (gequal(gel(M,1), gel(P,1))) { avma = ltop; return gen_0; } if (low_stack(st_lim, stack_lim(btop, 1))) M = gerepileupto(btop, M); } return gerepilecopy(ltop, SL2_div_mul_e1(gel(N,2),gel(M,2)));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/483d59e20c9966bdd012e7e829be1b438419faa8/Qfb.c/clean/src/basemath/Qfb.c |
gel(P,2) = negi(gel(P,2));/*This form leads to a smaller solution*/ P = M = redrealsl2(P); | P1 = redrealsl2(P); gel(P,2) = negi(gel(P,2)); P2 = redrealsl2(P); | qfbrealsolvep(GEN Q, GEN p){ pari_sp ltop = avma, btop, st_lim; GEN N, P, M, d = qf_disc(Q); if (kronecker(d, p) < 0) { avma = ltop; return gen_0; } N = redrealsl2(Q); P = primeform(d, p, DEFAULTPREC); gel(P,2) = negi(gel(P,2));/*This form leads to a smaller solution*/ P = M = redrealsl2(P); btop = avma; st_lim = stack_lim(btop, 1); while (!gequal(gel(M,1), gel(N,1))) { M = redrealsl2step(M); if (gequal(gel(M,1), gel(P,1))) { avma = ltop; return gen_0; } if (low_stack(st_lim, stack_lim(btop, 1))) M = gerepileupto(btop, M); } return gerepilecopy(ltop, SL2_div_mul_e1(gel(N,2),gel(M,2)));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/483d59e20c9966bdd012e7e829be1b438419faa8/Qfb.c/clean/src/basemath/Qfb.c |
while (!gequal(gel(M,1), gel(N,1))) | while (!gequal(gel(M,1), gel(P1,1)) && !gequal(gel(M,1), gel(P2,1))) | qfbrealsolvep(GEN Q, GEN p){ pari_sp ltop = avma, btop, st_lim; GEN N, P, M, d = qf_disc(Q); if (kronecker(d, p) < 0) { avma = ltop; return gen_0; } N = redrealsl2(Q); P = primeform(d, p, DEFAULTPREC); gel(P,2) = negi(gel(P,2));/*This form leads to a smaller solution*/ P = M = redrealsl2(P); btop = avma; st_lim = stack_lim(btop, 1); while (!gequal(gel(M,1), gel(N,1))) { M = redrealsl2step(M); if (gequal(gel(M,1), gel(P,1))) { avma = ltop; return gen_0; } if (low_stack(st_lim, stack_lim(btop, 1))) M = gerepileupto(btop, M); } return gerepilecopy(ltop, SL2_div_mul_e1(gel(N,2),gel(M,2)));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/483d59e20c9966bdd012e7e829be1b438419faa8/Qfb.c/clean/src/basemath/Qfb.c |
if (gequal(gel(M,1), gel(P,1))) { avma = ltop; return gen_0; } | if (gequal(gel(M,1), gel(N,1))) { avma = ltop; return gen_0; } | qfbrealsolvep(GEN Q, GEN p){ pari_sp ltop = avma, btop, st_lim; GEN N, P, M, d = qf_disc(Q); if (kronecker(d, p) < 0) { avma = ltop; return gen_0; } N = redrealsl2(Q); P = primeform(d, p, DEFAULTPREC); gel(P,2) = negi(gel(P,2));/*This form leads to a smaller solution*/ P = M = redrealsl2(P); btop = avma; st_lim = stack_lim(btop, 1); while (!gequal(gel(M,1), gel(N,1))) { M = redrealsl2step(M); if (gequal(gel(M,1), gel(P,1))) { avma = ltop; return gen_0; } if (low_stack(st_lim, stack_lim(btop, 1))) M = gerepileupto(btop, M); } return gerepilecopy(ltop, SL2_div_mul_e1(gel(N,2),gel(M,2)));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/483d59e20c9966bdd012e7e829be1b438419faa8/Qfb.c/clean/src/basemath/Qfb.c |
return gerepilecopy(ltop, SL2_div_mul_e1(gel(N,2),gel(M,2))); | if (gequal(gel(M,1),gel(P1,1))) return gerepilecopy(ltop, SL2_div_mul_e1(gel(M,2),gel(P1,2))); else return gerepilecopy(ltop, SL2_div_mul_e1(gel(M,2),gel(P2,2))); | qfbrealsolvep(GEN Q, GEN p){ pari_sp ltop = avma, btop, st_lim; GEN N, P, M, d = qf_disc(Q); if (kronecker(d, p) < 0) { avma = ltop; return gen_0; } N = redrealsl2(Q); P = primeform(d, p, DEFAULTPREC); gel(P,2) = negi(gel(P,2));/*This form leads to a smaller solution*/ P = M = redrealsl2(P); btop = avma; st_lim = stack_lim(btop, 1); while (!gequal(gel(M,1), gel(N,1))) { M = redrealsl2step(M); if (gequal(gel(M,1), gel(P,1))) { avma = ltop; return gen_0; } if (low_stack(st_lim, stack_lim(btop, 1))) M = gerepileupto(btop, M); } return gerepilecopy(ltop, SL2_div_mul_e1(gel(N,2),gel(M,2)));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/483d59e20c9966bdd012e7e829be1b438419faa8/Qfb.c/clean/src/basemath/Qfb.c |
switch( whence ) { case SEEK_SET: /* absolute move from the start of the file */ | switch( whence ) { case SEEK_SET: /* absolute move from the start of the file */ | int imfs_dir_lseek( rtems_libio_t *iop, off_t offset, int whence){ off_t normal_offset; normal_offset = (offset/sizeof(struct dirent)) * sizeof(struct dirent); switch( whence ) { case SEEK_SET: /* absolute move from the start of the file */ iop->offset = normal_offset; break; case SEEK_CUR: /* relative move */ iop->offset = iop->offset + normal_offset; break; case SEEK_END: /* Movement past the end of the directory via lseek */ /* is not a permitted operation */ default: set_errno_and_return_minus_one( EINVAL ); break; } return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/662678d1d9aa92862d72fa7d25fc07cf6333ade0/imfs_directory.c/clean/cpukit/libfs/src/imfs/imfs_directory.c |
case SEEK_CUR: /* relative move */ | case SEEK_CUR: /* relative move */ | int imfs_dir_lseek( rtems_libio_t *iop, off_t offset, int whence){ off_t normal_offset; normal_offset = (offset/sizeof(struct dirent)) * sizeof(struct dirent); switch( whence ) { case SEEK_SET: /* absolute move from the start of the file */ iop->offset = normal_offset; break; case SEEK_CUR: /* relative move */ iop->offset = iop->offset + normal_offset; break; case SEEK_END: /* Movement past the end of the directory via lseek */ /* is not a permitted operation */ default: set_errno_and_return_minus_one( EINVAL ); break; } return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/662678d1d9aa92862d72fa7d25fc07cf6333ade0/imfs_directory.c/clean/cpukit/libfs/src/imfs/imfs_directory.c |
case SEEK_END: /* Movement past the end of the directory via lseek */ /* is not a permitted operation */ | case SEEK_END: /* Movement past the end of the directory via lseek */ /* is not a permitted operation */ | int imfs_dir_lseek( rtems_libio_t *iop, off_t offset, int whence){ off_t normal_offset; normal_offset = (offset/sizeof(struct dirent)) * sizeof(struct dirent); switch( whence ) { case SEEK_SET: /* absolute move from the start of the file */ iop->offset = normal_offset; break; case SEEK_CUR: /* relative move */ iop->offset = iop->offset + normal_offset; break; case SEEK_END: /* Movement past the end of the directory via lseek */ /* is not a permitted operation */ default: set_errno_and_return_minus_one( EINVAL ); break; } return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/662678d1d9aa92862d72fa7d25fc07cf6333ade0/imfs_directory.c/clean/cpukit/libfs/src/imfs/imfs_directory.c |
return -1; /* It wasn't a directory --> return error */ | return -1; /* It wasn't a directory --> return error */ | int imfs_dir_open( rtems_libio_t *iop, const char *pathname, unsigned32 flag, unsigned32 mode){ IMFS_jnode_t *the_jnode; /* Is the node a directory ? */ the_jnode = (IMFS_jnode_t *) iop->file_info; if ( the_jnode->type != IMFS_DIRECTORY ) return -1; /* It wasn't a directory --> return error */ iop->offset = 0; return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/662678d1d9aa92862d72fa7d25fc07cf6333ade0/imfs_directory.c/clean/cpukit/libfs/src/imfs/imfs_directory.c |
/* The generic close routine handles the deallocation of the file control */ /* and associated memory. At present the imfs_dir_close simply */ /* returns a successful completion status */ | /* * The generic close routine handles the deallocation of the file control * and associated memory. At present the imfs_dir_close simply * returns a successful completion status. */ | int imfs_dir_close( rtems_libio_t *iop){ /* The generic close routine handles the deallocation of the file control */ /* and associated memory. At present the imfs_dir_close simply */ /* returns a successful completion status */ return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/662678d1d9aa92862d72fa7d25fc07cf6333ade0/imfs_directory.c/clean/cpukit/libfs/src/imfs/imfs_directory.c |
int current_entry; int first_entry; int last_entry; | int current_entry; int first_entry; int last_entry; | int imfs_dir_read( rtems_libio_t *iop, void *buffer, unsigned32 count){ /* * Read up to element iop->offset in the directory chain of the * imfs_jnode_t struct for this file descriptor. */ Chain_Node *the_node; Chain_Control *the_chain; IMFS_jnode_t *the_jnode; int bytes_transferred; int current_entry; int first_entry; int last_entry; struct dirent tmp_dirent; the_jnode = (IMFS_jnode_t *)iop->file_info; the_chain = &the_jnode->info.directory.Entries; if ( Chain_Is_empty( the_chain ) ) return 0; /* Move to the first of the desired directory entries */ the_node = the_chain->first; bytes_transferred = 0; first_entry = iop->offset; /* protect against using sizes that are not exact multiples of the */ /* -dirent- size. These could result in unexpected results */ last_entry = first_entry + (count/sizeof(struct dirent)) * sizeof(struct dirent); /* The directory was not empty so try to move to the desired entry in chain*/ for( current_entry = 0; current_entry < last_entry; current_entry = current_entry + sizeof(struct dirent) ){ if ( Chain_Is_tail( the_chain, the_node ) ){ /* We hit the tail of the chain while trying to move to the first */ /* entry in the read */ return bytes_transferred; /* Indicate that there are no more */ /* entries to return */ } if( current_entry >= first_entry ) { /* Move the entry to the return buffer */ tmp_dirent.d_off = current_entry; tmp_dirent.d_reclen = sizeof( struct dirent ); the_jnode = (IMFS_jnode_t *) the_node; tmp_dirent.d_ino = the_jnode->st_ino; tmp_dirent.d_namlen = strlen( the_jnode->name ); strcpy( tmp_dirent.d_name, the_jnode->name ); memcpy( buffer + bytes_transferred, (void *)&tmp_dirent, sizeof( struct dirent ) ); iop->offset = iop->offset + sizeof(struct dirent); bytes_transferred = bytes_transferred + sizeof( struct dirent ); } the_node = the_node->next; } /* Success */ return bytes_transferred;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/662678d1d9aa92862d72fa7d25fc07cf6333ade0/imfs_directory.c/clean/cpukit/libfs/src/imfs/imfs_directory.c |
for( | for ( | int imfs_dir_read( rtems_libio_t *iop, void *buffer, unsigned32 count){ /* * Read up to element iop->offset in the directory chain of the * imfs_jnode_t struct for this file descriptor. */ Chain_Node *the_node; Chain_Control *the_chain; IMFS_jnode_t *the_jnode; int bytes_transferred; int current_entry; int first_entry; int last_entry; struct dirent tmp_dirent; the_jnode = (IMFS_jnode_t *)iop->file_info; the_chain = &the_jnode->info.directory.Entries; if ( Chain_Is_empty( the_chain ) ) return 0; /* Move to the first of the desired directory entries */ the_node = the_chain->first; bytes_transferred = 0; first_entry = iop->offset; /* protect against using sizes that are not exact multiples of the */ /* -dirent- size. These could result in unexpected results */ last_entry = first_entry + (count/sizeof(struct dirent)) * sizeof(struct dirent); /* The directory was not empty so try to move to the desired entry in chain*/ for( current_entry = 0; current_entry < last_entry; current_entry = current_entry + sizeof(struct dirent) ){ if ( Chain_Is_tail( the_chain, the_node ) ){ /* We hit the tail of the chain while trying to move to the first */ /* entry in the read */ return bytes_transferred; /* Indicate that there are no more */ /* entries to return */ } if( current_entry >= first_entry ) { /* Move the entry to the return buffer */ tmp_dirent.d_off = current_entry; tmp_dirent.d_reclen = sizeof( struct dirent ); the_jnode = (IMFS_jnode_t *) the_node; tmp_dirent.d_ino = the_jnode->st_ino; tmp_dirent.d_namlen = strlen( the_jnode->name ); strcpy( tmp_dirent.d_name, the_jnode->name ); memcpy( buffer + bytes_transferred, (void *)&tmp_dirent, sizeof( struct dirent ) ); iop->offset = iop->offset + sizeof(struct dirent); bytes_transferred = bytes_transferred + sizeof( struct dirent ); } the_node = the_node->next; } /* Success */ return bytes_transferred;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/662678d1d9aa92862d72fa7d25fc07cf6333ade0/imfs_directory.c/clean/cpukit/libfs/src/imfs/imfs_directory.c |
cand = fincke_pohst(A, nB, 20000, prec2, &chk); | cand = fincke_pohst(A, nB, -1, prec2, &chk); | RecCoeff3(GEN nf, RC_data *d, long prec){ GEN A, M, nB, cand, p1, B2, C2, tB, beta2, eps, nf2, Bd; GEN beta = d->beta, B = d->B; long N = d->N, v = d->v; long i, j, k, l, ct = 0, prec2; pari_sp av = avma; FP_chk_fun chk = { &chk_reccoeff, &chk_reccoeff_init, NULL, 0 }; chk.data = (void*)d; d->G = min(-10, -bit_accuracy(prec) >> 4); eps = gpowgs(stoi(10), min(-8, (d->G >> 1))); tB = gpow(gmul2n(eps, N), gdivgs(gun, 1-N), DEFAULTPREC); Bd = gceil(gmin(B, tB)); p1 = gceil(gdiv(glog(Bd, DEFAULTPREC), dbltor(2.3026))); prec2 = max((prec << 1) - 2, (long)(itos(p1) * pariK1 + BIGDEFAULTPREC)); nf2 = nfnewprec(nf, prec2); beta2 = gprec_w(beta, prec2); LABrcf: ct++; B2 = sqri(Bd); C2 = gdiv(B2, gsqr(eps)); M = gmael(nf2, 5, 1); d->M = M; A = cgetg(N+2, t_MAT); for (i = 1; i <= N+1; i++) A[i] = lgetg(N+2, t_COL); coeff(A, 1, 1) = ladd(gmul(C2, gsqr(beta2)), B2); for (j = 2; j <= N+1; j++) { p1 = gmul(C2, gmul(gneg_i(beta2), gcoeff(M, v, j-1))); coeff(A, 1, j) = coeff(A, j, 1) = (long)p1; } for (i = 2; i <= N+1; i++) for (j = 2; j <= N+1; j++) { p1 = gzero; for (k = 1; k <= N; k++) { GEN p2 = gmul(gcoeff(M, k, j-1), gcoeff(M, k, i-1)); if (k == v) p2 = gmul(C2, p2); p1 = gadd(p1,p2); } coeff(A, i, j) = coeff(A, j, i) = (long)p1; } nB = mulsi(N+1, B2); d->nB = nB; cand = fincke_pohst(A, nB, 20000, prec2, &chk); if (!cand) { if (ct > 3) { avma = av; return NULL; } prec2 = (prec2 << 1) - 2; if (DEBUGLEVEL >= 2) err(warnprec,"RecCoeff", prec2); nf2 = nfnewprec(nf2, prec2); beta2 = gprec_w(beta2, prec2); goto LABrcf; } cand = (GEN)cand[1]; l = lg(cand) - 1; if (l == 1) return gerepileupto(av, basistoalg(nf, (GEN)cand[1])); if (DEBUGLEVEL >= 2) fprintferr("RecCoeff3: no solution found!\n"); avma = av; return NULL;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/653c31bb14638fc78f469fb8d983bc98cc520ad5/stark.c/clean/src/modules/stark.c |
for ( ; i < dg; i++) c2[i] = 0; | /* cast necessary to work around a gcc-2.96 bug on alpha-linux (IS) */ for ( ; i < (short)dg; i++) c2[i] = 0; | MulPolmodCoeff(GEN polmod, int* c1, int** reduc, long dg){ long av,i,j; int c, *c2, *c3; if (gcmp1(polmod)) return; for (i = 0; i < dg; i++) if (c1[i]) break; if (i == dg) return; av = avma; c3 = (int*)new_chunk(2*dg); c2 = (int*)new_chunk(dg); Polmod2Coeff(c2,polmod, dg); for (i = 0; i < 2*dg; i++) { c = 0; for (j = 0; j <= i; j++) if (j < dg && j > i - dg) c += c1[j] * c2[i-j]; c3[i] = c; } c2 = c1; for (i = 0; i < dg; i++) { c = c3[i]; for (j = 0; j < dg; j++) c += reduc[j][i] * c3[dg+j]; c2[i] = c; } for ( ; i < dg; i++) c2[i] = 0; avma = av;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8467102a6a27beaf59536b306453c962bd7c55b2/stark.c/clean/src/modules/stark.c |
if (isexactzero(t)) x = bitprec; | if (isexactzero(t)) x = -bitprec; | roots_com(GEN q, long bitprec){ GEN L, p; long v = polvaluation_inexact(q, &p); if (lgef(p) == 3) L = cgetg(1,t_VEC); /* constant polynomial */ else L = isexactpol(p)? solve_exact_pol(p,bitprec): all_roots(p,bitprec); if (v) { GEN M, z, t = (GEN)q[2]; long i, x, y, l, n; if (isexactzero(t)) x = bitprec; else { n = gexpo(t); x = n / v; l = degpol(q); for (i = v; i <= l; i++) { t = (GEN)q[i+2]; if (isexactzero(t)) continue; y = (n - gexpo(t)) / i; if (y < x) x = y; } } z = realzero_bit(x); l = v + lg(L); M = cgetg(l, t_VEC); L -= v; for (i = 1; i <= v; i++) M[i] = (long)z; for ( ; i < l; i++) M[i] = L[i]; L = M; } return L;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a23f9850c579ac752cd3b95396e293ec99897020/rootpol.c/buggy/src/basemath/rootpol.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/exec/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/exec/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/exec/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/exec/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/exec/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/exec/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/exec/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/exec/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/exec/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/exec/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/exec/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/exec/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/exec/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/exec/libnetworking/libc/res_debug.c |
GEN theta = gmodulcp(gadd(polx[varn(pol)], gmul(k, gmodulcp(polx[varn(T)],T))), pol); return poleval(x, theta); | return poleval(x, get_theta_abstorel(T,pol,k)); | eltabstorel(GEN x, GEN T, GEN pol, GEN k){ GEN theta = gmodulcp(gadd(polx[varn(pol)], gmul(k, gmodulcp(polx[varn(T)],T))), pol); return poleval(x, theta);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/a5e638b286f7f0b1bfa207e5d061bdc61536732e/base5.c/clean/src/basemath/base5.c |
mapOverAll(int ismaster, int (*func)(int,int,volatile LERegister *,void*), void *arg) | mapOverAll(volatile LERegister *base, int ismaster, int (*func)(int,int,volatile LERegister *,void*), void *arg) | mapOverAll(int ismaster, int (*func)(int,int,volatile LERegister *,void*), void *arg){#define base vmeUniverse0BaseAddrvolatile LERegister *rptr;unsigned long port;int rval; /* get the universe base address */ if (!base && vmeUniverseInit()) { uprintf(stderr,"unable to find the universe in pci config space\n"); return -1; } rptr = (base + (ismaster ? UNIV_REGOFF_PCITGT0_CTRL : UNIV_REGOFF_VMESLV0_CTRL)/sizeof(LERegister));#undef TSILL#ifdef TSILL uprintf(stderr,"mapoverall: base is 0x%08x, rptr 0x%08x\n",base,rptr);#endif#undef TSILL for (port=0; port<4; port++) { if ((rval=func(ismaster,port,rptr,arg))) return rval; rptr+=5; /* register block spacing */ } /* only rev. 2 has 8 ports */ if (UNIV_REV(base)<2) return -1; rptr = (base + (ismaster ? UNIV_REGOFF_PCITGT4_CTRL : UNIV_REGOFF_VMESLV4_CTRL)/sizeof(LERegister)); for (port=4; port<UNIV_NUM_MPORTS; port++) { if ((rval=func(ismaster,port,rptr,arg))) return rval; rptr+=5; /* register block spacing */ } return 0;#undef base} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/784e792a04c600b79d535ad81a5ba32b4f4de33e/vmeUniverse.c/clean/c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.c |
#define base vmeUniverse0BaseAddr | mapOverAll(int ismaster, int (*func)(int,int,volatile LERegister *,void*), void *arg){#define base vmeUniverse0BaseAddrvolatile LERegister *rptr;unsigned long port;int rval; /* get the universe base address */ if (!base && vmeUniverseInit()) { uprintf(stderr,"unable to find the universe in pci config space\n"); return -1; } rptr = (base + (ismaster ? UNIV_REGOFF_PCITGT0_CTRL : UNIV_REGOFF_VMESLV0_CTRL)/sizeof(LERegister));#undef TSILL#ifdef TSILL uprintf(stderr,"mapoverall: base is 0x%08x, rptr 0x%08x\n",base,rptr);#endif#undef TSILL for (port=0; port<4; port++) { if ((rval=func(ismaster,port,rptr,arg))) return rval; rptr+=5; /* register block spacing */ } /* only rev. 2 has 8 ports */ if (UNIV_REV(base)<2) return -1; rptr = (base + (ismaster ? UNIV_REGOFF_PCITGT4_CTRL : UNIV_REGOFF_VMESLV4_CTRL)/sizeof(LERegister)); for (port=4; port<UNIV_NUM_MPORTS; port++) { if ((rval=func(ismaster,port,rptr,arg))) return rval; rptr+=5; /* register block spacing */ } return 0;#undef base} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/784e792a04c600b79d535ad81a5ba32b4f4de33e/vmeUniverse.c/clean/c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.c |
|
/* get the universe base address */ if (!base && vmeUniverseInit()) { uprintf(stderr,"unable to find the universe in pci config space\n"); return -1; } rptr = (base + | CHECK_DFLT_BASE(base); rptr = (base + | mapOverAll(int ismaster, int (*func)(int,int,volatile LERegister *,void*), void *arg){#define base vmeUniverse0BaseAddrvolatile LERegister *rptr;unsigned long port;int rval; /* get the universe base address */ if (!base && vmeUniverseInit()) { uprintf(stderr,"unable to find the universe in pci config space\n"); return -1; } rptr = (base + (ismaster ? UNIV_REGOFF_PCITGT0_CTRL : UNIV_REGOFF_VMESLV0_CTRL)/sizeof(LERegister));#undef TSILL#ifdef TSILL uprintf(stderr,"mapoverall: base is 0x%08x, rptr 0x%08x\n",base,rptr);#endif#undef TSILL for (port=0; port<4; port++) { if ((rval=func(ismaster,port,rptr,arg))) return rval; rptr+=5; /* register block spacing */ } /* only rev. 2 has 8 ports */ if (UNIV_REV(base)<2) return -1; rptr = (base + (ismaster ? UNIV_REGOFF_PCITGT4_CTRL : UNIV_REGOFF_VMESLV4_CTRL)/sizeof(LERegister)); for (port=4; port<UNIV_NUM_MPORTS; port++) { if ((rval=func(ismaster,port,rptr,arg))) return rval; rptr+=5; /* register block spacing */ } return 0;#undef base} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/784e792a04c600b79d535ad81a5ba32b4f4de33e/vmeUniverse.c/clean/c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.c |
rptr = (base + | rptr = (base + | mapOverAll(int ismaster, int (*func)(int,int,volatile LERegister *,void*), void *arg){#define base vmeUniverse0BaseAddrvolatile LERegister *rptr;unsigned long port;int rval; /* get the universe base address */ if (!base && vmeUniverseInit()) { uprintf(stderr,"unable to find the universe in pci config space\n"); return -1; } rptr = (base + (ismaster ? UNIV_REGOFF_PCITGT0_CTRL : UNIV_REGOFF_VMESLV0_CTRL)/sizeof(LERegister));#undef TSILL#ifdef TSILL uprintf(stderr,"mapoverall: base is 0x%08x, rptr 0x%08x\n",base,rptr);#endif#undef TSILL for (port=0; port<4; port++) { if ((rval=func(ismaster,port,rptr,arg))) return rval; rptr+=5; /* register block spacing */ } /* only rev. 2 has 8 ports */ if (UNIV_REV(base)<2) return -1; rptr = (base + (ismaster ? UNIV_REGOFF_PCITGT4_CTRL : UNIV_REGOFF_VMESLV4_CTRL)/sizeof(LERegister)); for (port=4; port<UNIV_NUM_MPORTS; port++) { if ((rval=func(ismaster,port,rptr,arg))) return rval; rptr+=5; /* register block spacing */ } return 0;#undef base} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/784e792a04c600b79d535ad81a5ba32b4f4de33e/vmeUniverse.c/clean/c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.c |
#undef base | mapOverAll(int ismaster, int (*func)(int,int,volatile LERegister *,void*), void *arg){#define base vmeUniverse0BaseAddrvolatile LERegister *rptr;unsigned long port;int rval; /* get the universe base address */ if (!base && vmeUniverseInit()) { uprintf(stderr,"unable to find the universe in pci config space\n"); return -1; } rptr = (base + (ismaster ? UNIV_REGOFF_PCITGT0_CTRL : UNIV_REGOFF_VMESLV0_CTRL)/sizeof(LERegister));#undef TSILL#ifdef TSILL uprintf(stderr,"mapoverall: base is 0x%08x, rptr 0x%08x\n",base,rptr);#endif#undef TSILL for (port=0; port<4; port++) { if ((rval=func(ismaster,port,rptr,arg))) return rval; rptr+=5; /* register block spacing */ } /* only rev. 2 has 8 ports */ if (UNIV_REV(base)<2) return -1; rptr = (base + (ismaster ? UNIV_REGOFF_PCITGT4_CTRL : UNIV_REGOFF_VMESLV4_CTRL)/sizeof(LERegister)); for (port=4; port<UNIV_NUM_MPORTS; port++) { if ((rval=func(ismaster,port,rptr,arg))) return rval; rptr+=5; /* register block spacing */ } return 0;#undef base} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/784e792a04c600b79d535ad81a5ba32b4f4de33e/vmeUniverse.c/clean/c/src/lib/libbsp/shared/vmeUniverse/vmeUniverse.c |
|
n=lx-1; if (n<=1) return lllall_trivial(x,n,flag); | n=lx-1; if (n<=1) return lllall_trivial(x,flag); | lllgramintwithcontent(GEN x, GEN veccon, long flag){ long lx=lg(x), i, j, k, l, n, kmax; gpmem_t av0=avma, av, lim; GEN u,u2,B,lam,q,r,h,la,bb,p1,p2,p3,p4,fl,corr,corr2,newcon; GEN *gptr[8]; if (typ(x) != t_MAT) err(typeer,"lllgramintwithcontent"); n=lx-1; if (n<=1) return lllall_trivial(x,n,flag); if (lg((GEN)x[1])!=lx) err(mattype1,"lllgramintwithcontent"); fl = new_chunk(lx); av=avma; lim=stack_lim(av,1); x=dummycopy(x); veccon=dummycopy(veccon); B=cgetg(lx+1,t_COL); B[1]=un; /* B[i+1]=B_i; le vrai B_i est B_i*prod(1,j=1,i,veccon[j]^2) */ for (i=1; i<lx; i++) { B[i+1]=zero; fl[i]=0; } lam=cgetg(lx,t_MAT); for (j=1; j<lx; j++) { p2=cgetg(lx,t_COL); lam[j]=(long)p2; for (i=1; i<lx; i++) p2[i]=zero; }/* le vrai lam[i,j] est lam[i,j]*veccon[i]*veccon[j]*prod(1,l=1,j-1,veccon[l]^2) */ k=2; h=idmat(n); kmax=1; u=gcoeff(x,1,1); if (typ(u)!=t_INT) err(lllger4); if (signe(u)) { B[2]=(long)u; coeff(lam,1,1)=un; fl[1]=1; } else { B[2]=un; fl[1]=0; } if (DEBUGLEVEL>5) { fprintferr("k = %ld",k); flusherr(); } for(;;) { if (k>kmax) { kmax=k; for (j=1; j<=k; j++) { if (j==k || fl[j]) { u=gcoeff(x,k,j); if (typ(u)!=t_INT) err(lllger4); for (i=1; i<j; i++) if (fl[i]) u=divii(subii(mulii((GEN)B[i+1],u),mulii(gcoeff(lam,k,i),gcoeff(lam,j,i))),(GEN)B[i]); if (j<k) coeff(lam,k,j)=(long)u; else { if (signe(u)) { B[k+1]=(long)u; coeff(lam,k,k)=un; fl[k]=1; } else { B[k+1]=B[k]; fl[k]=0; } } } } if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[1]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&veccon; gerepilemany(av,gptr,5); } } u=shifti(mulii(gcoeff(lam,k,k-1),(GEN)veccon[k]),1); u2=mulii((GEN)B[k],(GEN)veccon[k-1]); if (cmpii(absi(u),u2)>0) { q=dvmdii(addii(u,u2),shifti(u2,1),&r); if (signe(r)<0) q=addsi(-1,q); h[k]=lsub((GEN)h[k],gmul(q,(GEN)h[k-1])); newcon=mppgcd((GEN)veccon[k],(GEN)veccon[k-1]); corr=divii((GEN)veccon[k],newcon); veccon[k]=(long)newcon; if(!gcmp1(corr)) { corr2=sqri(corr); for (j=1; j<=n; j++) coeff(x,j,k)=coeff(x,k,j)=lmulii(corr,gcoeff(x,k,j)); coeff(x,k,k)=lmulii(corr,gcoeff(x,k,k)); for (j=k; j<=kmax; j++) B[j+1]=lmulii(corr2,(GEN)B[j+1]); for (i=1; i<k; i++) coeff(lam,k,i)=lmulii(corr,gcoeff(lam,k,i)); for (i=k+1; i<=kmax; i++) { coeff(lam,i,k)=lmulii(corr,gcoeff(lam,i,k)); for (j=k+1; j<i; j++) coeff(lam,i,j)=lmulii(corr2,gcoeff(lam,i,j)); } } r=negi(mulii(q,divii((GEN)veccon[k-1],(GEN)veccon[k]))); p1=gcoeff(x,k,k-1); for (j=1; j<=n; j++) coeff(x,j,k)=coeff(x,k,j)=laddii(gcoeff(x,j,k),mulii(r,(j==k)?p1:gcoeff(x,j,k-1))); coeff(x,k,k)=laddii(gcoeff(x,k,k),mulii(r,gcoeff(x,k-1,k))); coeff(lam,k,k-1)=laddii(gcoeff(lam,k,k-1),mulii(r,(GEN)B[k])); for (i=1; i<k-1; i++) coeff(lam,k,i)=laddii(gcoeff(lam,k,i),mulii(r,gcoeff(lam,k-1,i))); } if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[2]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&veccon; gerepilemany(av,gptr,5); } p3=mulii((GEN)B[k-1],(GEN)B[k+1]);la=gcoeff(lam,k,k-1);p4=mulii(la,la); p2=mulsi(100,mulii(mulii((GEN)veccon[k],(GEN)veccon[k]),addii(p3,p4))); p1=mulii((GEN)veccon[k-1],(GEN)B[k]);p1=mulsi(99,mulii(p1,p1)); if (fl[k-1] && (cmpii(p1,p2)>0 || !fl[k])) { if (DEBUGLEVEL>=4 && k==n) { fprintferr(" (%ld)", expi(p1)-expi(p2)); flusherr(); } p1=(GEN)h[k-1]; h[k-1]=h[k]; h[k]=(long)p1; p1=(GEN)x[k-1]; x[k-1]=x[k]; x[k]=(long)p1; for (j=1; j<=n; j++) { p1=gcoeff(x,k-1,j); coeff(x,k-1,j)=coeff(x,k,j); coeff(x,k,j)=(long)p1; } p1=(GEN)veccon[k-1]; veccon[k-1]=veccon[k]; veccon[k]=(long)p1; for (j=1; j<=k-2; j++) { p1=gcoeff(lam,k-1,j); coeff(lam,k-1,j)=coeff(lam,k,j); coeff(lam,k,j)=(long)p1; } if (fl[k]) { for (i=k+1; i<=kmax; i++) { bb=gcoeff(lam,i,k); coeff(lam,i,k)=ldivii(subii(mulii((GEN)B[k+1],gcoeff(lam,i,k-1)),mulii(la,bb)),(GEN)B[k]); coeff(lam,i,k-1)=ldivii(addii(mulii(la,gcoeff(lam,i,k-1)),mulii((GEN)B[k-1],bb)),(GEN)B[k]); if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[3]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&la; gptr[5]=&veccon; gptr[6]=&p3; gptr[7]=&p4; gerepilemany(av,gptr,8); } } B[k]=ldivii(addii(p3,p4),(GEN)B[k]); } else { if (signe(la)) { p2=(GEN)B[k]; p1=divii(p4,p2); for (i=k+1; i<=kmax; i++) coeff(lam,i,k-1)=ldivii(mulii(la,gcoeff(lam,i,k-1)),p2); for (j=k+1; j<kmax; j++) { for (i=j+1; i<=kmax; i++) coeff(lam,i,j)=ldivii(mulii(p1,gcoeff(lam,i,j)),p2); if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[4]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&la; gptr[5]=&veccon; gptr[6]=&p1; gptr[7]=&p2; gerepilemany(av,gptr,8); } } B[k+1]=B[k]=(long)p1; for (i=k+2; i<=lx; i++) B[i]=ldivii(mulii(p1,(GEN)B[i]),p2); } else { coeff(lam,k,k-1)=zero; for (i=k+1; i<=kmax; i++) { coeff(lam,i,k)=coeff(lam,i,k-1); coeff(lam,i,k-1)=zero; } B[k]=B[k-1]; fl[k]=1; fl[k-1]=0; } if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[5]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&veccon; gerepilemany(av,gptr,5); } } if (k>2) k--; if (DEBUGLEVEL>5) { fprintferr(" %ld",k); flusherr(); } } else { for (l=k-2; l>=1; l--) { u=shifti(mulii(gcoeff(lam,k,l),(GEN)veccon[k]),1); u2=mulii((GEN)B[l+1],(GEN)veccon[l]); if (cmpii(absi(u),u2)>0) { q=dvmdii(addii(u,u2),shifti(u2,1),&r); if (signe(r)<0) q=addsi(-1,q); h[k]=lsub((GEN)h[k],gmul(q,(GEN)h[l])); newcon=mppgcd((GEN)veccon[k],(GEN)veccon[l]); corr=divii((GEN)veccon[k],newcon); veccon[k]=(long)newcon; if(!gcmp1(corr)) { corr2=sqri(corr); for (j=1; j<=n; j++) coeff(x,j,k)=coeff(x,k,j)=lmulii(corr,gcoeff(x,k,j)); coeff(x,k,k)=lmulii(corr,gcoeff(x,k,k)); for (j=k; j<=kmax; j++) B[j+1]=lmulii(corr2,(GEN)B[j+1]); for (i=1; i<k; i++) coeff(lam,k,i)=lmulii(corr,gcoeff(lam,k,i)); for (i=k+1; i<=kmax; i++) { coeff(lam,i,k)=lmulii(corr,gcoeff(lam,i,k)); for (j=k+1; j<i; j++) coeff(lam,i,j)=lmulii(corr2,gcoeff(lam,i,j)); } } r=negi(mulii(q,divii((GEN)veccon[l],(GEN)veccon[k]))); p1=gcoeff(x,k,l); for (j=1; j<=n; j++) coeff(x,j,k)=coeff(x,k,j)=laddii(gcoeff(x,j,k),mulii(r,(j==k)?p1:gcoeff(x,j,l))); coeff(x,k,k)=laddii(gcoeff(x,k,k),mulii(r,gcoeff(x,l,k))); coeff(lam,k,l)=laddii(gcoeff(lam,k,l),mulii(r,(GEN)B[l+1])); for (i=1; i<l; i++) coeff(lam,k,i)=laddii(gcoeff(lam,k,i),mulii(r,gcoeff(lam,l,i))); } if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[6]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&veccon; gerepilemany(av,gptr,5); } } k++; if (DEBUGLEVEL>5) { fprintferr(" %ld",k); flusherr(); } if (k>n) { if (DEBUGLEVEL>5) { fprintferr("\n"); flusherr(); } return gerepilecopy(av0, lllgramall_finish(h,fl,flag,n)); } } if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[7]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&veccon; gerepilemany(av,gptr,5); } }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7ec0d8dd5294b6c092a40f82b2564f7f5961461c/bibli1.c/buggy/src/basemath/bibli1.c |
return gerepilecopy(av0, lllgramall_finish(h,fl,flag,n)); | return gerepilecopy(av0, lllgramall_finish(h,fl,flag)); | lllgramintwithcontent(GEN x, GEN veccon, long flag){ long lx=lg(x), i, j, k, l, n, kmax; gpmem_t av0=avma, av, lim; GEN u,u2,B,lam,q,r,h,la,bb,p1,p2,p3,p4,fl,corr,corr2,newcon; GEN *gptr[8]; if (typ(x) != t_MAT) err(typeer,"lllgramintwithcontent"); n=lx-1; if (n<=1) return lllall_trivial(x,n,flag); if (lg((GEN)x[1])!=lx) err(mattype1,"lllgramintwithcontent"); fl = new_chunk(lx); av=avma; lim=stack_lim(av,1); x=dummycopy(x); veccon=dummycopy(veccon); B=cgetg(lx+1,t_COL); B[1]=un; /* B[i+1]=B_i; le vrai B_i est B_i*prod(1,j=1,i,veccon[j]^2) */ for (i=1; i<lx; i++) { B[i+1]=zero; fl[i]=0; } lam=cgetg(lx,t_MAT); for (j=1; j<lx; j++) { p2=cgetg(lx,t_COL); lam[j]=(long)p2; for (i=1; i<lx; i++) p2[i]=zero; }/* le vrai lam[i,j] est lam[i,j]*veccon[i]*veccon[j]*prod(1,l=1,j-1,veccon[l]^2) */ k=2; h=idmat(n); kmax=1; u=gcoeff(x,1,1); if (typ(u)!=t_INT) err(lllger4); if (signe(u)) { B[2]=(long)u; coeff(lam,1,1)=un; fl[1]=1; } else { B[2]=un; fl[1]=0; } if (DEBUGLEVEL>5) { fprintferr("k = %ld",k); flusherr(); } for(;;) { if (k>kmax) { kmax=k; for (j=1; j<=k; j++) { if (j==k || fl[j]) { u=gcoeff(x,k,j); if (typ(u)!=t_INT) err(lllger4); for (i=1; i<j; i++) if (fl[i]) u=divii(subii(mulii((GEN)B[i+1],u),mulii(gcoeff(lam,k,i),gcoeff(lam,j,i))),(GEN)B[i]); if (j<k) coeff(lam,k,j)=(long)u; else { if (signe(u)) { B[k+1]=(long)u; coeff(lam,k,k)=un; fl[k]=1; } else { B[k+1]=B[k]; fl[k]=0; } } } } if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[1]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&veccon; gerepilemany(av,gptr,5); } } u=shifti(mulii(gcoeff(lam,k,k-1),(GEN)veccon[k]),1); u2=mulii((GEN)B[k],(GEN)veccon[k-1]); if (cmpii(absi(u),u2)>0) { q=dvmdii(addii(u,u2),shifti(u2,1),&r); if (signe(r)<0) q=addsi(-1,q); h[k]=lsub((GEN)h[k],gmul(q,(GEN)h[k-1])); newcon=mppgcd((GEN)veccon[k],(GEN)veccon[k-1]); corr=divii((GEN)veccon[k],newcon); veccon[k]=(long)newcon; if(!gcmp1(corr)) { corr2=sqri(corr); for (j=1; j<=n; j++) coeff(x,j,k)=coeff(x,k,j)=lmulii(corr,gcoeff(x,k,j)); coeff(x,k,k)=lmulii(corr,gcoeff(x,k,k)); for (j=k; j<=kmax; j++) B[j+1]=lmulii(corr2,(GEN)B[j+1]); for (i=1; i<k; i++) coeff(lam,k,i)=lmulii(corr,gcoeff(lam,k,i)); for (i=k+1; i<=kmax; i++) { coeff(lam,i,k)=lmulii(corr,gcoeff(lam,i,k)); for (j=k+1; j<i; j++) coeff(lam,i,j)=lmulii(corr2,gcoeff(lam,i,j)); } } r=negi(mulii(q,divii((GEN)veccon[k-1],(GEN)veccon[k]))); p1=gcoeff(x,k,k-1); for (j=1; j<=n; j++) coeff(x,j,k)=coeff(x,k,j)=laddii(gcoeff(x,j,k),mulii(r,(j==k)?p1:gcoeff(x,j,k-1))); coeff(x,k,k)=laddii(gcoeff(x,k,k),mulii(r,gcoeff(x,k-1,k))); coeff(lam,k,k-1)=laddii(gcoeff(lam,k,k-1),mulii(r,(GEN)B[k])); for (i=1; i<k-1; i++) coeff(lam,k,i)=laddii(gcoeff(lam,k,i),mulii(r,gcoeff(lam,k-1,i))); } if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[2]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&veccon; gerepilemany(av,gptr,5); } p3=mulii((GEN)B[k-1],(GEN)B[k+1]);la=gcoeff(lam,k,k-1);p4=mulii(la,la); p2=mulsi(100,mulii(mulii((GEN)veccon[k],(GEN)veccon[k]),addii(p3,p4))); p1=mulii((GEN)veccon[k-1],(GEN)B[k]);p1=mulsi(99,mulii(p1,p1)); if (fl[k-1] && (cmpii(p1,p2)>0 || !fl[k])) { if (DEBUGLEVEL>=4 && k==n) { fprintferr(" (%ld)", expi(p1)-expi(p2)); flusherr(); } p1=(GEN)h[k-1]; h[k-1]=h[k]; h[k]=(long)p1; p1=(GEN)x[k-1]; x[k-1]=x[k]; x[k]=(long)p1; for (j=1; j<=n; j++) { p1=gcoeff(x,k-1,j); coeff(x,k-1,j)=coeff(x,k,j); coeff(x,k,j)=(long)p1; } p1=(GEN)veccon[k-1]; veccon[k-1]=veccon[k]; veccon[k]=(long)p1; for (j=1; j<=k-2; j++) { p1=gcoeff(lam,k-1,j); coeff(lam,k-1,j)=coeff(lam,k,j); coeff(lam,k,j)=(long)p1; } if (fl[k]) { for (i=k+1; i<=kmax; i++) { bb=gcoeff(lam,i,k); coeff(lam,i,k)=ldivii(subii(mulii((GEN)B[k+1],gcoeff(lam,i,k-1)),mulii(la,bb)),(GEN)B[k]); coeff(lam,i,k-1)=ldivii(addii(mulii(la,gcoeff(lam,i,k-1)),mulii((GEN)B[k-1],bb)),(GEN)B[k]); if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[3]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&la; gptr[5]=&veccon; gptr[6]=&p3; gptr[7]=&p4; gerepilemany(av,gptr,8); } } B[k]=ldivii(addii(p3,p4),(GEN)B[k]); } else { if (signe(la)) { p2=(GEN)B[k]; p1=divii(p4,p2); for (i=k+1; i<=kmax; i++) coeff(lam,i,k-1)=ldivii(mulii(la,gcoeff(lam,i,k-1)),p2); for (j=k+1; j<kmax; j++) { for (i=j+1; i<=kmax; i++) coeff(lam,i,j)=ldivii(mulii(p1,gcoeff(lam,i,j)),p2); if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[4]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&la; gptr[5]=&veccon; gptr[6]=&p1; gptr[7]=&p2; gerepilemany(av,gptr,8); } } B[k+1]=B[k]=(long)p1; for (i=k+2; i<=lx; i++) B[i]=ldivii(mulii(p1,(GEN)B[i]),p2); } else { coeff(lam,k,k-1)=zero; for (i=k+1; i<=kmax; i++) { coeff(lam,i,k)=coeff(lam,i,k-1); coeff(lam,i,k-1)=zero; } B[k]=B[k-1]; fl[k]=1; fl[k-1]=0; } if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[5]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&veccon; gerepilemany(av,gptr,5); } } if (k>2) k--; if (DEBUGLEVEL>5) { fprintferr(" %ld",k); flusherr(); } } else { for (l=k-2; l>=1; l--) { u=shifti(mulii(gcoeff(lam,k,l),(GEN)veccon[k]),1); u2=mulii((GEN)B[l+1],(GEN)veccon[l]); if (cmpii(absi(u),u2)>0) { q=dvmdii(addii(u,u2),shifti(u2,1),&r); if (signe(r)<0) q=addsi(-1,q); h[k]=lsub((GEN)h[k],gmul(q,(GEN)h[l])); newcon=mppgcd((GEN)veccon[k],(GEN)veccon[l]); corr=divii((GEN)veccon[k],newcon); veccon[k]=(long)newcon; if(!gcmp1(corr)) { corr2=sqri(corr); for (j=1; j<=n; j++) coeff(x,j,k)=coeff(x,k,j)=lmulii(corr,gcoeff(x,k,j)); coeff(x,k,k)=lmulii(corr,gcoeff(x,k,k)); for (j=k; j<=kmax; j++) B[j+1]=lmulii(corr2,(GEN)B[j+1]); for (i=1; i<k; i++) coeff(lam,k,i)=lmulii(corr,gcoeff(lam,k,i)); for (i=k+1; i<=kmax; i++) { coeff(lam,i,k)=lmulii(corr,gcoeff(lam,i,k)); for (j=k+1; j<i; j++) coeff(lam,i,j)=lmulii(corr2,gcoeff(lam,i,j)); } } r=negi(mulii(q,divii((GEN)veccon[l],(GEN)veccon[k]))); p1=gcoeff(x,k,l); for (j=1; j<=n; j++) coeff(x,j,k)=coeff(x,k,j)=laddii(gcoeff(x,j,k),mulii(r,(j==k)?p1:gcoeff(x,j,l))); coeff(x,k,k)=laddii(gcoeff(x,k,k),mulii(r,gcoeff(x,l,k))); coeff(lam,k,l)=laddii(gcoeff(lam,k,l),mulii(r,(GEN)B[l+1])); for (i=1; i<l; i++) coeff(lam,k,i)=laddii(gcoeff(lam,k,i),mulii(r,gcoeff(lam,l,i))); } if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[6]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&veccon; gerepilemany(av,gptr,5); } } k++; if (DEBUGLEVEL>5) { fprintferr(" %ld",k); flusherr(); } if (k>n) { if (DEBUGLEVEL>5) { fprintferr("\n"); flusherr(); } return gerepilecopy(av0, lllgramall_finish(h,fl,flag,n)); } } if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[7]: lllgramintwithcontent"); gptr[0]=&B; gptr[1]=&lam; gptr[2]=&h; gptr[3]=&x; gptr[4]=&veccon; gerepilemany(av,gptr,5); } }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7ec0d8dd5294b6c092a40f82b2564f7f5961461c/bibli1.c/buggy/src/basemath/bibli1.c |
if (i>N) | if (i > N) | mat_ideal_two_elt(GEN nf, GEN x){ GEN y,a,beta,cx,xZ,mul; long i,lm, N = degpol(nf[1]); gpmem_t av,tetpil; y = cgetg(3,t_VEC); av = avma; if (lg(x[1]) != N+1) err(typeer,"ideal_two_elt"); if (N == 2) { y[1] = lcopy(gcoeff(x,1,1)); y[2] = lcopy((GEN)x[2]); return y; } x = Q_primitive_part(x, &cx); if (!cx) cx = gun; if (lg(x) != N+1) x = idealhermite_aux(nf,x); xZ = gcoeff(x,1,1); if (gcmp1(xZ)) { y[1] = lpilecopy(av,cx); y[2] = (long)gscalcol(cx, N); return y; } a = NULL; /* gcc -Wall */ beta= cgetg(N+1, t_VEC); mul = cgetg(N+1, t_VEC); lm = 1; /* = lg(mul) */ /* look for a in x such that a O/xZ = x O/xZ */ for (i=2; i<=N; i++) { GEN t, y = eltmul_get_table(nf, (GEN)x[i]); t = gmod(y, xZ); if (gcmp0(t)) continue; if (ok_elt(x,xZ, t)) { a = (GEN)x[i]; break; } beta[lm]= x[i]; /* mul[i] = { canonical generators for x[i] O/xZ as Z-module } */ mul[lm] = (long)t; lm++; } if (i>N) { GEN z = cgetg(lm, t_VECSMALL); gpmem_t av1; ulong c = 0; setlg(mul, lm); setlg(beta,lm); if (DEBUGLEVEL>3) fprintferr("ideal_two_elt, hard case: "); for(av1=avma;;avma=av1) { c++; if (DEBUGLEVEL>3 && (c & 0x3f) == 0) fprintferr("%ld ", c); if (c == 100) { a = mat_ideal_two_elt2(nf, x, xZ); goto END; } for (a=NULL,i=1; i<lm; i++) { long t = (mymyrand() >> (BITS_IN_RANDOM-5)) - 7; /* in [-7,8] */ z[i] = t; a = addmul_mat(a, t, (GEN)mul[i]); } /* a = matrix (NOT HNF) of ideal generated by beta.z in O/xZ */ if (a && ok_elt(x,xZ, a)) break; } for (a=NULL,i=1; i<lm; i++) a = addmul_col(a, z[i], (GEN)beta[i]); if (DEBUGLEVEL>3) fprintferr("\n"); }END: a = centermod(a, xZ); tetpil = avma; y[1] = lmul(xZ,cx); y[2] = lmul(a, cx); gerepilemanyvec(av,tetpil,y+1,2); return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/50a78b1721942afaab9072574af42783c21032d2/base4.c/clean/src/basemath/base4.c |
if (DEBUGLEVEL>3) fprintferr("ideal_two_elt, hard case: "); | if (DEBUGLEVEL>3) fprintferr("ideal_two_elt, hard case:\n"); | mat_ideal_two_elt(GEN nf, GEN x){ GEN y,a,beta,cx,xZ,mul; long i,lm, N = degpol(nf[1]); gpmem_t av,tetpil; y = cgetg(3,t_VEC); av = avma; if (lg(x[1]) != N+1) err(typeer,"ideal_two_elt"); if (N == 2) { y[1] = lcopy(gcoeff(x,1,1)); y[2] = lcopy((GEN)x[2]); return y; } x = Q_primitive_part(x, &cx); if (!cx) cx = gun; if (lg(x) != N+1) x = idealhermite_aux(nf,x); xZ = gcoeff(x,1,1); if (gcmp1(xZ)) { y[1] = lpilecopy(av,cx); y[2] = (long)gscalcol(cx, N); return y; } a = NULL; /* gcc -Wall */ beta= cgetg(N+1, t_VEC); mul = cgetg(N+1, t_VEC); lm = 1; /* = lg(mul) */ /* look for a in x such that a O/xZ = x O/xZ */ for (i=2; i<=N; i++) { GEN t, y = eltmul_get_table(nf, (GEN)x[i]); t = gmod(y, xZ); if (gcmp0(t)) continue; if (ok_elt(x,xZ, t)) { a = (GEN)x[i]; break; } beta[lm]= x[i]; /* mul[i] = { canonical generators for x[i] O/xZ as Z-module } */ mul[lm] = (long)t; lm++; } if (i>N) { GEN z = cgetg(lm, t_VECSMALL); gpmem_t av1; ulong c = 0; setlg(mul, lm); setlg(beta,lm); if (DEBUGLEVEL>3) fprintferr("ideal_two_elt, hard case: "); for(av1=avma;;avma=av1) { c++; if (DEBUGLEVEL>3 && (c & 0x3f) == 0) fprintferr("%ld ", c); if (c == 100) { a = mat_ideal_two_elt2(nf, x, xZ); goto END; } for (a=NULL,i=1; i<lm; i++) { long t = (mymyrand() >> (BITS_IN_RANDOM-5)) - 7; /* in [-7,8] */ z[i] = t; a = addmul_mat(a, t, (GEN)mul[i]); } /* a = matrix (NOT HNF) of ideal generated by beta.z in O/xZ */ if (a && ok_elt(x,xZ, a)) break; } for (a=NULL,i=1; i<lm; i++) a = addmul_col(a, z[i], (GEN)beta[i]); if (DEBUGLEVEL>3) fprintferr("\n"); }END: a = centermod(a, xZ); tetpil = avma; y[1] = lmul(xZ,cx); y[2] = lmul(a, cx); gerepilemanyvec(av,tetpil,y+1,2); return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/50a78b1721942afaab9072574af42783c21032d2/base4.c/clean/src/basemath/base4.c |
c++; if (DEBUGLEVEL>3 && (c & 0x3f) == 0) fprintferr("%ld ", c); if (c == 100) { a = mat_ideal_two_elt2(nf, x, xZ); goto END; } | if (++c == 100) { if (DEBUGLEVEL>3) fprintferr("using approximation theorem\n"); a = mat_ideal_two_elt2(nf, x, xZ); goto END; } | mat_ideal_two_elt(GEN nf, GEN x){ GEN y,a,beta,cx,xZ,mul; long i,lm, N = degpol(nf[1]); gpmem_t av,tetpil; y = cgetg(3,t_VEC); av = avma; if (lg(x[1]) != N+1) err(typeer,"ideal_two_elt"); if (N == 2) { y[1] = lcopy(gcoeff(x,1,1)); y[2] = lcopy((GEN)x[2]); return y; } x = Q_primitive_part(x, &cx); if (!cx) cx = gun; if (lg(x) != N+1) x = idealhermite_aux(nf,x); xZ = gcoeff(x,1,1); if (gcmp1(xZ)) { y[1] = lpilecopy(av,cx); y[2] = (long)gscalcol(cx, N); return y; } a = NULL; /* gcc -Wall */ beta= cgetg(N+1, t_VEC); mul = cgetg(N+1, t_VEC); lm = 1; /* = lg(mul) */ /* look for a in x such that a O/xZ = x O/xZ */ for (i=2; i<=N; i++) { GEN t, y = eltmul_get_table(nf, (GEN)x[i]); t = gmod(y, xZ); if (gcmp0(t)) continue; if (ok_elt(x,xZ, t)) { a = (GEN)x[i]; break; } beta[lm]= x[i]; /* mul[i] = { canonical generators for x[i] O/xZ as Z-module } */ mul[lm] = (long)t; lm++; } if (i>N) { GEN z = cgetg(lm, t_VECSMALL); gpmem_t av1; ulong c = 0; setlg(mul, lm); setlg(beta,lm); if (DEBUGLEVEL>3) fprintferr("ideal_two_elt, hard case: "); for(av1=avma;;avma=av1) { c++; if (DEBUGLEVEL>3 && (c & 0x3f) == 0) fprintferr("%ld ", c); if (c == 100) { a = mat_ideal_two_elt2(nf, x, xZ); goto END; } for (a=NULL,i=1; i<lm; i++) { long t = (mymyrand() >> (BITS_IN_RANDOM-5)) - 7; /* in [-7,8] */ z[i] = t; a = addmul_mat(a, t, (GEN)mul[i]); } /* a = matrix (NOT HNF) of ideal generated by beta.z in O/xZ */ if (a && ok_elt(x,xZ, a)) break; } for (a=NULL,i=1; i<lm; i++) a = addmul_col(a, z[i], (GEN)beta[i]); if (DEBUGLEVEL>3) fprintferr("\n"); }END: a = centermod(a, xZ); tetpil = avma; y[1] = lmul(xZ,cx); y[2] = lmul(a, cx); gerepilemanyvec(av,tetpil,y+1,2); return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/50a78b1721942afaab9072574af42783c21032d2/base4.c/clean/src/basemath/base4.c |
if (DEBUGLEVEL>3) fprintferr("\n"); | mat_ideal_two_elt(GEN nf, GEN x){ GEN y,a,beta,cx,xZ,mul; long i,lm, N = degpol(nf[1]); gpmem_t av,tetpil; y = cgetg(3,t_VEC); av = avma; if (lg(x[1]) != N+1) err(typeer,"ideal_two_elt"); if (N == 2) { y[1] = lcopy(gcoeff(x,1,1)); y[2] = lcopy((GEN)x[2]); return y; } x = Q_primitive_part(x, &cx); if (!cx) cx = gun; if (lg(x) != N+1) x = idealhermite_aux(nf,x); xZ = gcoeff(x,1,1); if (gcmp1(xZ)) { y[1] = lpilecopy(av,cx); y[2] = (long)gscalcol(cx, N); return y; } a = NULL; /* gcc -Wall */ beta= cgetg(N+1, t_VEC); mul = cgetg(N+1, t_VEC); lm = 1; /* = lg(mul) */ /* look for a in x such that a O/xZ = x O/xZ */ for (i=2; i<=N; i++) { GEN t, y = eltmul_get_table(nf, (GEN)x[i]); t = gmod(y, xZ); if (gcmp0(t)) continue; if (ok_elt(x,xZ, t)) { a = (GEN)x[i]; break; } beta[lm]= x[i]; /* mul[i] = { canonical generators for x[i] O/xZ as Z-module } */ mul[lm] = (long)t; lm++; } if (i>N) { GEN z = cgetg(lm, t_VECSMALL); gpmem_t av1; ulong c = 0; setlg(mul, lm); setlg(beta,lm); if (DEBUGLEVEL>3) fprintferr("ideal_two_elt, hard case: "); for(av1=avma;;avma=av1) { c++; if (DEBUGLEVEL>3 && (c & 0x3f) == 0) fprintferr("%ld ", c); if (c == 100) { a = mat_ideal_two_elt2(nf, x, xZ); goto END; } for (a=NULL,i=1; i<lm; i++) { long t = (mymyrand() >> (BITS_IN_RANDOM-5)) - 7; /* in [-7,8] */ z[i] = t; a = addmul_mat(a, t, (GEN)mul[i]); } /* a = matrix (NOT HNF) of ideal generated by beta.z in O/xZ */ if (a && ok_elt(x,xZ, a)) break; } for (a=NULL,i=1; i<lm; i++) a = addmul_col(a, z[i], (GEN)beta[i]); if (DEBUGLEVEL>3) fprintferr("\n"); }END: a = centermod(a, xZ); tetpil = avma; y[1] = lmul(xZ,cx); y[2] = lmul(a, cx); gerepilemanyvec(av,tetpil,y+1,2); return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/50a78b1721942afaab9072574af42783c21032d2/base4.c/clean/src/basemath/base4.c |
|
lllgramall_finish(GEN h,GEN fl,long flag,long n) | lllgramall_finish(GEN h,GEN fl,long flag) | lllgramall_finish(GEN h,GEN fl,long flag,long n){ long i, k; GEN y, g; k=1; while (k<=n && !fl[k]) k++; switch(flag) { case lll_KER: setlg(h,k); return h; case lll_IM: h += k-1; h[0] = evaltyp(t_MAT)| evallg(n-k+2); return h; } y = cgetg(3,t_VEC); g = cgetg(k, t_MAT); for (i=1; i<k; i++) g[i] = h[i]; y[1] = (long)g; h += k-1; h[0] = evaltyp(t_MAT)| evallg(n-k+2); y[2] = (long)h; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7ec0d8dd5294b6c092a40f82b2564f7f5961461c/bibli1.c/buggy/src/basemath/bibli1.c |
long i, k; | long i, k, l = lg(fl); | lllgramall_finish(GEN h,GEN fl,long flag,long n){ long i, k; GEN y, g; k=1; while (k<=n && !fl[k]) k++; switch(flag) { case lll_KER: setlg(h,k); return h; case lll_IM: h += k-1; h[0] = evaltyp(t_MAT)| evallg(n-k+2); return h; } y = cgetg(3,t_VEC); g = cgetg(k, t_MAT); for (i=1; i<k; i++) g[i] = h[i]; y[1] = (long)g; h += k-1; h[0] = evaltyp(t_MAT)| evallg(n-k+2); y[2] = (long)h; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7ec0d8dd5294b6c092a40f82b2564f7f5961461c/bibli1.c/buggy/src/basemath/bibli1.c |
k=1; while (k<=n && !fl[k]) k++; | k=1; while (k<l && !fl[k]) k++; | lllgramall_finish(GEN h,GEN fl,long flag,long n){ long i, k; GEN y, g; k=1; while (k<=n && !fl[k]) k++; switch(flag) { case lll_KER: setlg(h,k); return h; case lll_IM: h += k-1; h[0] = evaltyp(t_MAT)| evallg(n-k+2); return h; } y = cgetg(3,t_VEC); g = cgetg(k, t_MAT); for (i=1; i<k; i++) g[i] = h[i]; y[1] = (long)g; h += k-1; h[0] = evaltyp(t_MAT)| evallg(n-k+2); y[2] = (long)h; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7ec0d8dd5294b6c092a40f82b2564f7f5961461c/bibli1.c/buggy/src/basemath/bibli1.c |
case lll_IM: h += k-1; h[0] = evaltyp(t_MAT)| evallg(n-k+2); | case lll_IM: h += k-1; h[0] = evaltyp(t_MAT)| evallg(l-k+1); | lllgramall_finish(GEN h,GEN fl,long flag,long n){ long i, k; GEN y, g; k=1; while (k<=n && !fl[k]) k++; switch(flag) { case lll_KER: setlg(h,k); return h; case lll_IM: h += k-1; h[0] = evaltyp(t_MAT)| evallg(n-k+2); return h; } y = cgetg(3,t_VEC); g = cgetg(k, t_MAT); for (i=1; i<k; i++) g[i] = h[i]; y[1] = (long)g; h += k-1; h[0] = evaltyp(t_MAT)| evallg(n-k+2); y[2] = (long)h; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7ec0d8dd5294b6c092a40f82b2564f7f5961461c/bibli1.c/buggy/src/basemath/bibli1.c |
h += k-1; h[0] = evaltyp(t_MAT)| evallg(n-k+2); | h += k-1; h[0] = evaltyp(t_MAT)| evallg(l-k+1); | lllgramall_finish(GEN h,GEN fl,long flag,long n){ long i, k; GEN y, g; k=1; while (k<=n && !fl[k]) k++; switch(flag) { case lll_KER: setlg(h,k); return h; case lll_IM: h += k-1; h[0] = evaltyp(t_MAT)| evallg(n-k+2); return h; } y = cgetg(3,t_VEC); g = cgetg(k, t_MAT); for (i=1; i<k; i++) g[i] = h[i]; y[1] = (long)g; h += k-1; h[0] = evaltyp(t_MAT)| evallg(n-k+2); y[2] = (long)h; return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7ec0d8dd5294b6c092a40f82b2564f7f5961461c/bibli1.c/buggy/src/basemath/bibli1.c |
asize = (1 + Xmin)*cache_arena - fixed_to_cache; | asize = (ulong)((1 + Xmin)*cache_arena - fixed_to_cache); | good_arena_size(ulong slow2_size, ulong total, ulong fixed_to_cache, cache_model_t *cache_model, long model_type){ ulong asize, cache_arena = cache_model->arena; double Xmin, Xmax, A, B, C1, C2, D, V; double alpha = cache_model->power, cut_off = cache_model->cutoff; /* Estimated relative slowdown, with overhead = max((fixed_to_cache+arena)/cache_arena - 1, 0): 1 + slow2_size/arena due to initialization overhead; max(1, 2.33 * overhead^0.29 ) due to footprint > cache size. [The latter is hard to substantiate theoretically, but this function describes benchmarks pretty close; it does not hurt that one can minimize it explicitly too ;-). The switch between diffenent choices of max() happens whe overhead=0.055.] Thus the problem is minimizing (1 + slow2_size/arena)*overhead**0.29. This boils down to F=((X+A)/(X+B))X^alpha, X=overhead, B = (1 - fixed_to_cache/cache_arena), A = B + slow2_size/cache_arena, alpha = 0.29, and X>=0.055, X>-B. It turns out that the minimization problem is not very nasty. (As usual with minimization problems which depend on parameters, different values of A,B lead to different algorithms. However, the boundaries between the domains in (A,B) plane where different algorithms work are explicitly calculatable.) Thus we need to find the rightmost root of (X+A)*(X+B) - alpha(A-B)X to the right of 0.055 (if such exists and is below Xmax). Then we manually check the remaining region [0, 0.055]. Since we cannot trust the purely-experimental cache-hit slowdown function, as a sanity check always prefer fitting into the cache (or "almost fitting") if F-law predicts that the larger value of the arena provides less than 10% speedup. */ if (model_type != 0) err(talker, "unsupported type of cache model"); /* Future expansion */ /* The simplest case: we fit into cache */ if (total + fixed_to_cache <= cache_arena) return total; /* The simple case: fitting into cache doesn't slow us down more than 10% */ if (cache_arena - fixed_to_cache > 10 * slow2_size) { asize = cache_arena - fixed_to_cache; if (asize > total) asize = total; /* Automatically false... */ return asize; } /* Slowdown of not fitting into cache is significant. Try to optimize. Do not be afraid to spend some time on optimization - in trivial cases we do not reach this point; any gain we get should compensate the time spent on optimization. */ B = (1 - ((double)fixed_to_cache)/cache_arena); A = B + ((double)slow2_size)/cache_arena; C2 = A*B; C1 = (A + B - 1/alpha*(A - B))/2; D = C1*C1 - C2; if (D > 0) V = cut_off*cut_off + 2*C1*cut_off + C2; /* Value at CUT_OFF */ else V = 0; /* Peacify the warning */ Xmin = cut_off; Xmax = ((double)total - fixed_to_cache)/cache_arena; /* Two candidates */ if ( D <= 0 || (V >= 0 && C1 + cut_off >= 0) ) /* slowdown increasing */ Xmax = cut_off; /* Only one candidate */ else if (V >= 0 && /* slowdown concave down */ ((Xmax + C1) <= 0 || (Xmax*Xmax + 2*C1*Xmax + C2) <= 0)) /* DO NOTHING */; /* Keep both candidates */ else if (V <= 0 && (Xmax*Xmax + 2*C1*Xmax + C2) <= 0) /* slowdown decreasing */ Xmin = cut_off; /* Only one candidate */ else /* Now we know: two root, the largest is in CUT_OFF..Xmax */ Xmax = sqrt(D) - C1; if (Xmax != Xmin) { /* Xmin == CUT_OFF; Check which one is better */ double v1 = (cut_off + A)/(cut_off + B); double v2 = 2.33 * (Xmax + A)/(Xmax + B) * pow(Xmax, alpha); if (1.1 * v2 >= v1) /* Prefer fitting into the cache if slowdown < 10% */ V = v1; else { Xmin = Xmax; V = v2; } } else if (B > 0) /* We need V */ V = 2.33 * (Xmin + A)/(Xmin + B) * pow(Xmin, alpha); if (B > 0 && 1.1 * V > A/B) /* Now Xmin is the minumum. Compare with 0 */ Xmin = 0; asize = (1 + Xmin)*cache_arena - fixed_to_cache; if (asize > total) asize = total; /* May happen due to approximations */ return asize;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/6061d5c53051b4d5381f664341d7bf7876a33f7e/arith2.c/clean/src/basemath/arith2.c |
lllall_trivial(GEN x, long n, long flag) | lllall_trivial(GEN x, long flag) | lllall_trivial(GEN x, long n, long flag){ GEN y; if (!n) { if (flag != lll_ALL) return cgetg(1,t_MAT); y=cgetg(3,t_VEC); y[1]=lgetg(1,t_MAT); y[2]=lgetg(1,t_MAT); return y; } /* here n = 1 */ if (gcmp0((GEN)x[1])) { switch(flag ^ lll_GRAM) { case lll_KER: return idmat(1); case lll_IM : return cgetg(1,t_MAT); default: y=cgetg(3,t_VEC); y[1]=(long)idmat(1); y[2]=lgetg(1,t_MAT); return y; } } if (flag & lll_GRAM) flag ^= lll_GRAM; else x = NULL; switch (flag) { case lll_KER: return cgetg(1,t_MAT); case lll_IM : return idmat(1); default: y=cgetg(3,t_VEC); y[1]=lgetg(1,t_MAT); y[2]=x? lcopy(x): (long)idmat(1); return y; }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7ec0d8dd5294b6c092a40f82b2564f7f5961461c/bibli1.c/buggy/src/basemath/bibli1.c |
if (!n) { | if (lg(x) == 1) { /* dim x = 0 */ | lllall_trivial(GEN x, long n, long flag){ GEN y; if (!n) { if (flag != lll_ALL) return cgetg(1,t_MAT); y=cgetg(3,t_VEC); y[1]=lgetg(1,t_MAT); y[2]=lgetg(1,t_MAT); return y; } /* here n = 1 */ if (gcmp0((GEN)x[1])) { switch(flag ^ lll_GRAM) { case lll_KER: return idmat(1); case lll_IM : return cgetg(1,t_MAT); default: y=cgetg(3,t_VEC); y[1]=(long)idmat(1); y[2]=lgetg(1,t_MAT); return y; } } if (flag & lll_GRAM) flag ^= lll_GRAM; else x = NULL; switch (flag) { case lll_KER: return cgetg(1,t_MAT); case lll_IM : return idmat(1); default: y=cgetg(3,t_VEC); y[1]=lgetg(1,t_MAT); y[2]=x? lcopy(x): (long)idmat(1); return y; }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7ec0d8dd5294b6c092a40f82b2564f7f5961461c/bibli1.c/buggy/src/basemath/bibli1.c |
/* here n = 1 */ | /* here dim = 1 */ | lllall_trivial(GEN x, long n, long flag){ GEN y; if (!n) { if (flag != lll_ALL) return cgetg(1,t_MAT); y=cgetg(3,t_VEC); y[1]=lgetg(1,t_MAT); y[2]=lgetg(1,t_MAT); return y; } /* here n = 1 */ if (gcmp0((GEN)x[1])) { switch(flag ^ lll_GRAM) { case lll_KER: return idmat(1); case lll_IM : return cgetg(1,t_MAT); default: y=cgetg(3,t_VEC); y[1]=(long)idmat(1); y[2]=lgetg(1,t_MAT); return y; } } if (flag & lll_GRAM) flag ^= lll_GRAM; else x = NULL; switch (flag) { case lll_KER: return cgetg(1,t_MAT); case lll_IM : return idmat(1); default: y=cgetg(3,t_VEC); y[1]=lgetg(1,t_MAT); y[2]=x? lcopy(x): (long)idmat(1); return y; }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7ec0d8dd5294b6c092a40f82b2564f7f5961461c/bibli1.c/buggy/src/basemath/bibli1.c |
void pci_initialize() | int pci_initialize() | void pci_initialize(){ int PciNumber; unchar ucBusNumber, ucSlotNumber, ucFnNumber, ucNumFuncs; unsigned int ulHeader; unsigned int pcidata, ulDeviceID;#if PCI_DEBUG unsigned int data, pcidata, ulClass; unsigned short sdata;#endif PCI_interface(); /* * Scan PCI0 and PCI1 bus0 */ for (PciNumber=0; PciNumber < 2; PciNumber++) { pciAccessInit(PciNumber); for (ucBusNumber=0; ucBusNumber< 2; ucBusNumber++) { for (ucSlotNumber=0;ucSlotNumber<PCI_MAX_DEVICES;ucSlotNumber++) { ucFnNumber = 0; PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_VENDOR_ID, &ulDeviceID); if( ulDeviceID==PCI_INVALID_VENDORDEVICEID) { /* This slot is empty */ continue; } if (++numPCIDevs > MAX_NUM_PCI_DEVICES) { BSP_panic("Too many PCI devices found; increase MAX_NUM_PCI_DEVICES in pcicache.c\n"); } switch(ulDeviceID) { case (PCI_VENDOR_ID_MARVELL+(PCI_DEVICE_ID_MARVELL_GT6426xAB<<16)):#if PCI_PRINT printk("Marvell GT6426xA/B hostbridge detected at PCI%d bus%d slot%d\n", PciNumber,ucBusNumber,ucSlotNumber);#endif ucMaxPCIBus ++; break; case (PCI_VENDOR_ID_PLX2+(PCI_DEVICE_ID_PLX2_PCI6154_HB2<<16)):#if PCI_PRINT printk("PLX PCI6154 PCI-PCI bridge detected at PCI%d bus%d slot%d\n", PciNumber,ucBusNumber,ucSlotNumber);#endif ucMaxPCIBus ++; break; case PCI_VENDOR_ID_TUNDRA:#if PCI_PRINT printk("TUNDRA PCI-VME bridge detected at PCI%d bus%d slot%d\n", PciNumber,ucBusNumber,ucSlotNumber);#endif ucMaxPCIBus ++; break; case (PCI_VENDOR_ID_INTEL+(PCI_DEVICE_INTEL_82544EI_COPPER<<16)):#if PCI_PRINT printk("INTEL 82544EI COPPER network controller detected at PCI%d bus%d slot%d\n", PciNumber,ucBusNumber,ucSlotNumber);#endif ucMaxPCIBus ++; break; default : #if PCI_PRINT printk("PCI%d Bus%d Slot%d DeviceID 0x%x \n", PciNumber,ucBusNumber,ucSlotNumber, ulDeviceID);#endif break; }#if PCI_DEBUG PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_BASE_ADDRESS_0, &data); printk("PCI%d_BASE_ADDRESS_0 0x%x \n",PciNumber, data); PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_BASE_ADDRESS_1, &data); printk("PCI%d_BASE_ADDRESS_1 0x%x \n",PciNumber, data); PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_BASE_ADDRESS_2, &data); printk("PCI%d_BASE_ADDRESS_2 0x%x \n",PciNumber, data); PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_BASE_ADDRESS_3, &data); printk("PCI%d_BASE_ADDRESS_3 0x%x \n",PciNumber, data); PCIx_read_config_word(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_INTERRUPT_LINE, &sdata); printk("PCI%d_INTERRUPT_LINE 0x%x \n",PciNumber, sdata); /* We always enable internal memory. */ PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_MEM_BASE_ADDR, &pcidata); printk("PCI%d_MEM_BASE_ADDR 0x%x \n", PciNumber,pcidata); /* We always enable internal IO. */ PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_IO_BASE_ADDR, &pcidata); printk("PCI%d_IO_BASE_ADDR 0x%x \n", PciNumber,pcidata);#endif PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_CACHE_LINE_SIZE, &ulHeader); if ((ulHeader>>16)&PCI_MULTI_FUNCTION) ucNumFuncs=PCI_MAX_FUNCTIONS; else ucNumFuncs=1;#if PCI_DEBUG printk("PCI%d Slot 0x%x HEADER/LAT/CACHE 0x%x \n", PciNumber,ucSlotNumber, ulHeader); for (ucFnNumber=1;ucFnNumber<ucNumFuncs;ucFnNumber++) { PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, ucFnNumber, PCI0_VENDOR_ID, &ulDeviceID); if (ulDeviceID==PCI_INVALID_VENDORDEVICEID) { /* This slot/function is empty */ continue; } if (++numPCIDevs > MAX_NUM_PCI_DEVICES) { BSP_panic("Too many PCI devices found; increase MAX_NUM_PCI_DEVICES in pcicache.c\n"); } /* This slot/function has a device fitted.*/ PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, ucFnNumber, PCI0_CLASS_REVISION, &ulClass); printk("PCI%d Slot 0x%x Func %d classID 0x%x \n",PciNumber,ucSlotNumber, ucFnNumber, ulClass); ulClass >>= 16; if (ulClass == PCI_CLASS_GT6426xAB) printk("GT64260-PCI%d bridge found \n", PciNumber); }#endif PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_COMMAND, &pcidata); #if PCI_DEBUG printk("MOTLoad command staus 0x%x, ", pcidata);#endif /* Clear the error on the host bridge */ if ( (ucBusNumber==0) && (ucSlotNumber==0)) pcidata |= PCI_STATUS_CLRERR_MASK; /* Enable bus,I/O and memory master access. */ pcidata |= (PCI_COMMAND_MASTER|PCI_COMMAND_IO|PCI_COMMAND_MEMORY); PCIx_write_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_COMMAND, pcidata); PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_COMMAND, &pcidata); #if PCI_DEBUG printk("Now command/staus 0x%x\n", pcidata);#endif } } } /* PCI number */} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3bfb6ef9dc6b7a21d3c0f87f306aff438176ccf0/pci.c/clean/c/src/lib/libbsp/powerpc/mvme5500/pci/pci.c |
return PCIB_ERR_SUCCESS; | void pci_initialize(){ int PciNumber; unchar ucBusNumber, ucSlotNumber, ucFnNumber, ucNumFuncs; unsigned int ulHeader; unsigned int pcidata, ulDeviceID;#if PCI_DEBUG unsigned int data, pcidata, ulClass; unsigned short sdata;#endif PCI_interface(); /* * Scan PCI0 and PCI1 bus0 */ for (PciNumber=0; PciNumber < 2; PciNumber++) { pciAccessInit(PciNumber); for (ucBusNumber=0; ucBusNumber< 2; ucBusNumber++) { for (ucSlotNumber=0;ucSlotNumber<PCI_MAX_DEVICES;ucSlotNumber++) { ucFnNumber = 0; PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_VENDOR_ID, &ulDeviceID); if( ulDeviceID==PCI_INVALID_VENDORDEVICEID) { /* This slot is empty */ continue; } if (++numPCIDevs > MAX_NUM_PCI_DEVICES) { BSP_panic("Too many PCI devices found; increase MAX_NUM_PCI_DEVICES in pcicache.c\n"); } switch(ulDeviceID) { case (PCI_VENDOR_ID_MARVELL+(PCI_DEVICE_ID_MARVELL_GT6426xAB<<16)):#if PCI_PRINT printk("Marvell GT6426xA/B hostbridge detected at PCI%d bus%d slot%d\n", PciNumber,ucBusNumber,ucSlotNumber);#endif ucMaxPCIBus ++; break; case (PCI_VENDOR_ID_PLX2+(PCI_DEVICE_ID_PLX2_PCI6154_HB2<<16)):#if PCI_PRINT printk("PLX PCI6154 PCI-PCI bridge detected at PCI%d bus%d slot%d\n", PciNumber,ucBusNumber,ucSlotNumber);#endif ucMaxPCIBus ++; break; case PCI_VENDOR_ID_TUNDRA:#if PCI_PRINT printk("TUNDRA PCI-VME bridge detected at PCI%d bus%d slot%d\n", PciNumber,ucBusNumber,ucSlotNumber);#endif ucMaxPCIBus ++; break; case (PCI_VENDOR_ID_INTEL+(PCI_DEVICE_INTEL_82544EI_COPPER<<16)):#if PCI_PRINT printk("INTEL 82544EI COPPER network controller detected at PCI%d bus%d slot%d\n", PciNumber,ucBusNumber,ucSlotNumber);#endif ucMaxPCIBus ++; break; default : #if PCI_PRINT printk("PCI%d Bus%d Slot%d DeviceID 0x%x \n", PciNumber,ucBusNumber,ucSlotNumber, ulDeviceID);#endif break; }#if PCI_DEBUG PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_BASE_ADDRESS_0, &data); printk("PCI%d_BASE_ADDRESS_0 0x%x \n",PciNumber, data); PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_BASE_ADDRESS_1, &data); printk("PCI%d_BASE_ADDRESS_1 0x%x \n",PciNumber, data); PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_BASE_ADDRESS_2, &data); printk("PCI%d_BASE_ADDRESS_2 0x%x \n",PciNumber, data); PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_BASE_ADDRESS_3, &data); printk("PCI%d_BASE_ADDRESS_3 0x%x \n",PciNumber, data); PCIx_read_config_word(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_INTERRUPT_LINE, &sdata); printk("PCI%d_INTERRUPT_LINE 0x%x \n",PciNumber, sdata); /* We always enable internal memory. */ PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_MEM_BASE_ADDR, &pcidata); printk("PCI%d_MEM_BASE_ADDR 0x%x \n", PciNumber,pcidata); /* We always enable internal IO. */ PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_IO_BASE_ADDR, &pcidata); printk("PCI%d_IO_BASE_ADDR 0x%x \n", PciNumber,pcidata);#endif PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_CACHE_LINE_SIZE, &ulHeader); if ((ulHeader>>16)&PCI_MULTI_FUNCTION) ucNumFuncs=PCI_MAX_FUNCTIONS; else ucNumFuncs=1;#if PCI_DEBUG printk("PCI%d Slot 0x%x HEADER/LAT/CACHE 0x%x \n", PciNumber,ucSlotNumber, ulHeader); for (ucFnNumber=1;ucFnNumber<ucNumFuncs;ucFnNumber++) { PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, ucFnNumber, PCI0_VENDOR_ID, &ulDeviceID); if (ulDeviceID==PCI_INVALID_VENDORDEVICEID) { /* This slot/function is empty */ continue; } if (++numPCIDevs > MAX_NUM_PCI_DEVICES) { BSP_panic("Too many PCI devices found; increase MAX_NUM_PCI_DEVICES in pcicache.c\n"); } /* This slot/function has a device fitted.*/ PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, ucFnNumber, PCI0_CLASS_REVISION, &ulClass); printk("PCI%d Slot 0x%x Func %d classID 0x%x \n",PciNumber,ucSlotNumber, ucFnNumber, ulClass); ulClass >>= 16; if (ulClass == PCI_CLASS_GT6426xAB) printk("GT64260-PCI%d bridge found \n", PciNumber); }#endif PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_COMMAND, &pcidata); #if PCI_DEBUG printk("MOTLoad command staus 0x%x, ", pcidata);#endif /* Clear the error on the host bridge */ if ( (ucBusNumber==0) && (ucSlotNumber==0)) pcidata |= PCI_STATUS_CLRERR_MASK; /* Enable bus,I/O and memory master access. */ pcidata |= (PCI_COMMAND_MASTER|PCI_COMMAND_IO|PCI_COMMAND_MEMORY); PCIx_write_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_COMMAND, pcidata); PCIx_read_config_dword(PciNumber, ucBusNumber, ucSlotNumber, 0, PCI0_COMMAND, &pcidata); #if PCI_DEBUG printk("Now command/staus 0x%x\n", pcidata);#endif } } } /* PCI number */} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3bfb6ef9dc6b7a21d3c0f87f306aff438176ccf0/pci.c/clean/c/src/lib/libbsp/powerpc/mvme5500/pci/pci.c |
|
p_sqrtu2(ulong u0, ulong u1, ulong *ps, ulong *pr) | p_sqrtu2(ulong *n, ulong *ps, ulong *pr) | p_sqrtu2(ulong u0, ulong u1, ulong *ps, ulong *pr){ ulong hi, r, s, t; LOCAL_HIREMAINDER; LOCAL_OVERFLOW; s = dblmantissa( sqrt((double)u0) ); /* high bit of s is set */ t = mulll(s, s); hi = u0 - hiremainder; if ((long)hi < 0) { /* rare but may occur */ s--; t -= (s << 1) | 1; /* t := t - (2s + 1) */ *ps = s; *pr = u1 - t; return 0; } if (!hi && t > u1) { /* rare but may occur */ s--; t -= (s << 1) | 1; /* t := t - (2s + 1) */ *ps = s; *pr = u1 - t; return 1; } r = subll(u1, t); if (overflow) hi--; /* remainder R = hi*2^BIL + r. hi <= 2 */ if (hi == 2) { /* correction, r := (2|r) - 2s - 1 */ r = subll(r, (s << 1) | 1); *pr = r; *ps = s + 1; return !overflow; } if (hi && (r > (s<<1))) { /* correction, r := (1|r) - 2s - 1 */ r -= (s << 1) | 1; s++; hi = 0; } *ps = s; *pr = r; return hi;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/95e454c6719c3b1c1e8284cb4b7fa228332d2f3d/mp.c/buggy/src/kernel/none/mp.c |
ulong hi, r, s, t; | ulong hi, r, s, t, u0 = n[0], u1 = n[1]; | p_sqrtu2(ulong u0, ulong u1, ulong *ps, ulong *pr){ ulong hi, r, s, t; LOCAL_HIREMAINDER; LOCAL_OVERFLOW; s = dblmantissa( sqrt((double)u0) ); /* high bit of s is set */ t = mulll(s, s); hi = u0 - hiremainder; if ((long)hi < 0) { /* rare but may occur */ s--; t -= (s << 1) | 1; /* t := t - (2s + 1) */ *ps = s; *pr = u1 - t; return 0; } if (!hi && t > u1) { /* rare but may occur */ s--; t -= (s << 1) | 1; /* t := t - (2s + 1) */ *ps = s; *pr = u1 - t; return 1; } r = subll(u1, t); if (overflow) hi--; /* remainder R = hi*2^BIL + r. hi <= 2 */ if (hi == 2) { /* correction, r := (2|r) - 2s - 1 */ r = subll(r, (s << 1) | 1); *pr = r; *ps = s + 1; return !overflow; } if (hi && (r > (s<<1))) { /* correction, r := (1|r) - 2s - 1 */ r -= (s << 1) | 1; s++; hi = 0; } *ps = s; *pr = r; return hi;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/95e454c6719c3b1c1e8284cb4b7fa228332d2f3d/mp.c/buggy/src/kernel/none/mp.c |
s = dblmantissa( sqrt((double)u0) ); /* high bit of s is set */ | s = sqrtu2(n); /* high bit of s is set */ | p_sqrtu2(ulong u0, ulong u1, ulong *ps, ulong *pr){ ulong hi, r, s, t; LOCAL_HIREMAINDER; LOCAL_OVERFLOW; s = dblmantissa( sqrt((double)u0) ); /* high bit of s is set */ t = mulll(s, s); hi = u0 - hiremainder; if ((long)hi < 0) { /* rare but may occur */ s--; t -= (s << 1) | 1; /* t := t - (2s + 1) */ *ps = s; *pr = u1 - t; return 0; } if (!hi && t > u1) { /* rare but may occur */ s--; t -= (s << 1) | 1; /* t := t - (2s + 1) */ *ps = s; *pr = u1 - t; return 1; } r = subll(u1, t); if (overflow) hi--; /* remainder R = hi*2^BIL + r. hi <= 2 */ if (hi == 2) { /* correction, r := (2|r) - 2s - 1 */ r = subll(r, (s << 1) | 1); *pr = r; *ps = s + 1; return !overflow; } if (hi && (r > (s<<1))) { /* correction, r := (1|r) - 2s - 1 */ r -= (s << 1) | 1; s++; hi = 0; } *ps = s; *pr = r; return hi;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/95e454c6719c3b1c1e8284cb4b7fa228332d2f3d/mp.c/buggy/src/kernel/none/mp.c |
return gerepileupto(av, gcopy(m)); | return gerepilecopy(av, m); | matqpascal(long n, GEN q){ long i,j,I, av = avma; GEN m, *qpow = NULL; /* gcc -Wall */ if (n<0) n = -1; n++; m = cgetg(n+1,t_MAT); for (j=1; j<=n; j++) m[j] = lgetg(n+1,t_COL); if (q) { I = (n+1)/2; if (I > 1) { qpow = (GEN*)new_chunk(I+1); qpow[2]=q; } for (j=3; j<=I; j++) qpow[j] = gmul(q, qpow[j-1]); } for (i=1; i<=n; i++) { I = (i+1)/2; coeff(m,i,1)=un; if (q) { for (j=2; j<=I; j++) coeff(m,i,j) = ladd(gmul(qpow[j],gcoeff(m,i-1,j)), gcoeff(m,i-1,j-1)); } else { for (j=2; j<=I; j++) coeff(m,i,j) = laddii(gcoeff(m,i-1,j), gcoeff(m,i-1,j-1)); } for ( ; j<=i; j++) coeff(m,i,j) = coeff(m,i,i+1-j); for ( ; j<=n; j++) coeff(m,i,j) = zero; } return gerepileupto(av, gcopy(m));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7168973a923818508c45aa17d871c53e9225fad1/bibli2.c/buggy/src/basemath/bibli2.c |
y=x; j=1+bfffo(m); m<<=j; j = BITS_IN_LONG-j; | y=x; j=1+bfffo((ulong)m); m<<=j; j = BITS_IN_LONG-j; | element_pow_mod_p(GEN nf, GEN x, GEN n, GEN p){ ulong av = avma; long s,N,i,j,m; GEN y,p1; if (typ(n)!=t_INT) err(talker,"not an integer exponent in nfpow"); nf=checknf(nf); N=degpol(nf[1]); s=signe(n); if (!s) return gscalcol_i(gun,N); if (typ(x)!=t_COL) x=algtobasis(nf,x); if (isnfscalar(x)) { y = gscalcol_i(gun,N); y[1] = (long)powmodulo((GEN)x[1],n,p); return y; } p1 = n+2; m = *p1; y=x; j=1+bfffo(m); m<<=j; j = BITS_IN_LONG-j; for (i=lgefint(n)-2;;) { for (; j; m<<=1,j--) { y = element_sqri(nf, y); if (m<0) y=element_muli(nf, y, x); y = FpV_red(y, p); } if (--i == 0) break; m = *++p1; j = BITS_IN_LONG; } if (s<0) y = FpV_red(element_inv(nf,y), p); return av==avma? gcopy(y): gerepileupto(av,y);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/6f0450eaf26bb1653fbb257487c2cbc116d69406/base3.c/clean/src/basemath/base3.c |
y1 = itor(x, lz+1); x = y; y = y1; | y1 = itor(x, lz); x = y; y = y1; | mulir(GEN x, GEN y){ long sx=signe(x),sy,lz,lzz,ey,e,p1,i,j; ulong garde; GEN z,y1; LOCAL_HIREMAINDER; LOCAL_OVERFLOW; if (!sx) return gzero; if (!is_bigint(x)) return mulsr(itos(x),y); sy=signe(y); ey=expo(y); if (!sy) return realzero_bit(expi(x)+ey); if (sy<0) sx = -sx; lz=lg(y); z=cgetr(lz); y1 = itor(x, lz+1); x = y; y = y1; e = expo(y)+ey; if (lz==3) { (void)mulll(x[2],y[3]); garde=addmul(x[2],y[2]); if ((long)hiremainder < 0) { z[2]=hiremainder; e++; } else z[2]=(hiremainder<<1) | (garde>>(BITS_IN_LONG-1)); z[1] = evalsigne(sx) | evalexpo(e); avma=(pari_sp)z; return z; } (void)mulll(x[2],y[lz]); garde=hiremainder; lzz=lz-1; p1=x[lzz]; if (p1) { (void)mulll(p1,y[3]); garde=addll(addmul(p1,y[2]),garde); z[lzz] = overflow+hiremainder; } else z[lzz]=0; for (j=lz-2, y1=y-j; j>=3; j--) { p1=x[j]; y1++; if (p1) { (void)mulll(p1,y1[lz+1]); garde = addll(addmul(p1,y1[lz]), garde); for (i=lzz; i>j; i--) { hiremainder += overflow; z[i] = addll(addmul(p1,y1[i]), z[i]); } z[j] = hiremainder+overflow; } else z[j]=0; } p1=x[2]; y1++; garde = addll(mulll(p1,y1[lz]), garde); for (i=lzz; i>2; i--) { hiremainder += overflow; z[i] = addll(addmul(p1,y1[i]), z[i]); } z[2] = hiremainder+overflow; if (z[2] < 0) e++; else shift_left(z,z,2,lzz,garde, 1); z[1] = evalsigne(sx) | evalexpo(e); avma=(pari_sp)z; return z;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/f6e2effd2aac52d3000b50f4ca3d05adf40af062/mp.c/clean/src/kernel/none/mp.c |
is = gtrunc(s); /* make s an integer */ N = itos(muluu(p,prec)) + xp; /* FIXME: crude estimation */ | N = itos(muluu(p,prec)) + xp; /* FIXME: quite arbitrary */ | zetap(GEN s){ ulong p; long xp, N, f, c, prec = precp(s); pari_sp av = avma; GEN gp, q, vz, is, cff, vtz, val, va, cft; if (valp(s) < 0) err(talker, "argument must be a gp-adic integer"); gp = (GEN)s[2]; p = itou(gp); xp = (long) log2(p); /* the extra precision; FIXME: quite arbitrary */ if (DEBUGLEVEL > 2) fprintferr("zetap: extra prec = %ld\n", xp); is = gtrunc(s); /* make s an integer */ N = itos(muluu(p,prec)) + xp; /* FIXME: crude estimation */ q = gpowgs(gp, prec + xp); /* initialize the roots of unity for the computation of the Teichmuller character (also the values of f and c) */ if (DEBUGLEVEL > 1) fprintferr("zetap: computing (p-1)th roots of 1\n"); vz = init_teich(p, q, prec + xp); if (p == 2UL) { f = 4; c = 3; } else { f = (long)p; c = 2; } /* compute the first N coefficients of the Mahler expansion of phi^(-1)_s skipping the first one (which is zero) */ if (DEBUGLEVEL > 1) fprintferr("zetap: computing Mahler expansion of phi^(-1)_s\n"); cff = coeff_of_phi_ms(p, q, -1, is, N, vz); /* compute the coefficients of the power series corresponding to the twisted partial zeta function Z_f(a, c, s) for a in va */ /* The line below looks a bit stupid but it is to keep the possibility of later adding gp-adic Dirichlet L-functions */ va = perm_identity(f - 1); if (DEBUGLEVEL > 1) fprintferr("zetap: computing twisted partial zeta functions\n"); vtz = twistpartialzeta(gp, q, f, c, va, cff); /* sum over all a's the coefficients of the twisted partial zeta functions and integrate */ if (DEBUGLEVEL > 1) fprintferr("zetap: summing up and multiplying by correcting factor\n"); /* sum and multiply by the corrective factor */ cft = gsubgs(gmulsg(c, phi_ms(p, q, -1, is, c, vz)), 1); val = gdiv(sum(vtz, 1, f-1), cft); /* adjust the precision and return */ return gerepileupto(av, cvtop(val, gp, prec));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/75bbe23ab8ce138cca18cb88feeca14172e80520/trans3.c/clean/src/basemath/trans3.c |
else { bnd = 1; /* bnd-hack is only for the case B = N */ if (typ(B) != t_INT) B = gfloor(B); } | if (typ(B) != t_INT) B = gceil(B); if (cmpis(X, X_SMALL) <= 0) return do_exhaustive(P0, N, itos(X), B); /* bnd-hack is only for the case B = N */ if (!egalii(B,N)) bnd = 1; | zncoppersmith(GEN P0, GEN N, GEN X, GEN B){ GEN Q, R, N0, M, sh, short_pol, *Xpowers, z, r, sol, nsp, P, tst, Z; int delta, ltop = avma, i, j, row, d, l, dim, t, bnd = 10; if (typ(P0) != t_POL || typ(N) != t_INT) err(typeer, "Coppersmith"); if (typ(X) != t_INT) X = gfloor(X); if (!B) B = N; else { bnd = 1; /* bnd-hack is only for the case B = N */ if (typ(B) != t_INT) B = gfloor(B); } P = dummycopy(P0); d = degpol(P); if (!gcmp1((GEN)P[d+2])) { P[d+2] = (long)bezout((GEN)P[d+2], N, &z, &r); for (j = 0; j < d; j++) P[j+2] = lmodii(mulii((GEN)P[j+2], z), N); } if (DEBUGLEVEL >= 2) fprintferr("Modified P: %Z\n", P); choose_params(P, N, X, B, &delta, &t); if (DEBUGLEVEL >= 2) fprintferr("Init: trying delta = %d, t = %d\n", delta, t); for(;;) { dim = d * delta + t; /* TODO: In case of failure do not recompute the full vector */ Xpowers = (GEN*)new_chunk(dim + 1); Xpowers[0] = gun; for (j = 1; j <= dim; j++) Xpowers[j] = gmul(Xpowers[j-1], X); /* TODO: in case of failure, use the part of the matrix already computed */ M = cgetg(dim + 1, t_MAT); for (j = 1; j <= dim; j++) M[j] = (long)zerocol(dim); /* Rows of M correspond to the polynomials * N^delta, N^delta Xi, ... N^delta (Xi)^d-1, * N^(delta-1)P(Xi), N^(delta-1)XiP(Xi), ... N^(delta-1)P(Xi)(Xi)^d-1, * ... * P(Xi)^delta, XiP(Xi)^delta, ..., P(Xi)^delta(Xi)^t-1 */ for (j = 1; j <= d; j++) coeff(M, j, j) = (long)Xpowers[j-1]; for ( ; j <= dim; j++) coeff(M, j, j) = un; /* P-part */ row = d + 1; Q = P; for (i = 1; i < delta; i++) { for (j = 0; j < d; j++,row++) for (l = j + 1; l <= row; l++) coeff(M, l, row) = lmulii(Xpowers[l-1], (GEN)Q[l-j+1]); Q = RgX_mul(Q, P); } for (j = 0; j < t; row++, j++) for (l = j + 1; l <= row; l++) coeff(M, l, row) = lmulii(Xpowers[l-1], (GEN)Q[l-j+1]); /* N-part */ row = dim - t; N0 = N; while (row >= 1) { for (j = 0; j < d; j++,row--) for (l = 1; l <= row; l++) coeff(M, l, row) = lmulii(gmael(M, row, l), N0); if (row >= 1) N0 = mulii(N0, N); } /* Z is the upper bound for the L^1 norm of the polynomial, ie. N^delta if B = N, B^delta otherwise */ if (B != N) Z = gpowgs(B, delta); else Z = N0; if (DEBUGLEVEL >= 2) { if (DEBUGLEVEL >= 6) fprintferr("Matrix to be reduced:\n%Z\n", M); fprintferr("Entering LLL\nbitsize bound: %ld\n", expi(Z)); fprintferr("expected shvector bitsize: %ld\n", expi(dethnf_i(M))/dim); } sh = lllint_fp_ip(M, 4); short_pol = (GEN)sh[1]; nsp = gzero; for (j = 1; j <= dim; j++) nsp = addii(nsp, absi((GEN)short_pol[j])); if (DEBUGLEVEL >= 2) { fprintferr("Candidate: %Z\n", short_pol); fprintferr("bitsize Norm: %ld\n", expi(nsp)); fprintferr("bitsize bound: %ld\n", expi(mulsi(bnd, Z))); } if (cmpii(nsp, mulsi(bnd, Z)) < 0) break; /* SUCCESS */ /* Failed with the precomputed or supplied value */ t++; if (t == d) { delta++; t = 1; } if (DEBUGLEVEL >= 2) fprintferr("Increasing dim, delta = %d t = %d\n", delta, t); } bnd = itos(divii(nsp, Z)) + 1; while (!signe(short_pol[dim])) dim--; R = cgetg(dim + 2, t_POL); R[1] = P[1]; for (j = 1; j <= dim; j++) R[j+1] = (long)diviiexact((GEN)short_pol[j], Xpowers[j-1]); R[2] = (long)subii((GEN)R[2], mulsi(bnd - 1, N0)); sol = cgetg(1, t_VEC); for (i = -bnd + 1; i < bnd; i++) { r = nfrootsQ(R); if (DEBUGLEVEL >= 2) fprintferr("Roots: %Z\n", r); for (j = 1; j < lg(r); j++) { z = (GEN)r[j]; tst = gcdii(FpX_eval(P, z, N), N); if (cmpii(tst, B) >= 0) /* We have found a factor of N >= B */ { for (l = 1; l < lg(sol) && !egalii(z, (GEN)sol[l]); l++) /*empty*/; if (l == lg(sol)) sol = concatsp(sol, z); } } if (i < bnd) R[2] = (long)addii((GEN)R[2], Z); } return gerepilecopy(ltop, sol);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8a4d3af5b53a4748031f6f6ddb8816d13214c33e/bibli1.c/buggy/src/basemath/bibli1.c |
for ( ; j <= dim; j++) coeff(M, j, j) = un; | zncoppersmith(GEN P0, GEN N, GEN X, GEN B){ GEN Q, R, N0, M, sh, short_pol, *Xpowers, z, r, sol, nsp, P, tst, Z; int delta, ltop = avma, i, j, row, d, l, dim, t, bnd = 10; if (typ(P0) != t_POL || typ(N) != t_INT) err(typeer, "Coppersmith"); if (typ(X) != t_INT) X = gfloor(X); if (!B) B = N; else { bnd = 1; /* bnd-hack is only for the case B = N */ if (typ(B) != t_INT) B = gfloor(B); } P = dummycopy(P0); d = degpol(P); if (!gcmp1((GEN)P[d+2])) { P[d+2] = (long)bezout((GEN)P[d+2], N, &z, &r); for (j = 0; j < d; j++) P[j+2] = lmodii(mulii((GEN)P[j+2], z), N); } if (DEBUGLEVEL >= 2) fprintferr("Modified P: %Z\n", P); choose_params(P, N, X, B, &delta, &t); if (DEBUGLEVEL >= 2) fprintferr("Init: trying delta = %d, t = %d\n", delta, t); for(;;) { dim = d * delta + t; /* TODO: In case of failure do not recompute the full vector */ Xpowers = (GEN*)new_chunk(dim + 1); Xpowers[0] = gun; for (j = 1; j <= dim; j++) Xpowers[j] = gmul(Xpowers[j-1], X); /* TODO: in case of failure, use the part of the matrix already computed */ M = cgetg(dim + 1, t_MAT); for (j = 1; j <= dim; j++) M[j] = (long)zerocol(dim); /* Rows of M correspond to the polynomials * N^delta, N^delta Xi, ... N^delta (Xi)^d-1, * N^(delta-1)P(Xi), N^(delta-1)XiP(Xi), ... N^(delta-1)P(Xi)(Xi)^d-1, * ... * P(Xi)^delta, XiP(Xi)^delta, ..., P(Xi)^delta(Xi)^t-1 */ for (j = 1; j <= d; j++) coeff(M, j, j) = (long)Xpowers[j-1]; for ( ; j <= dim; j++) coeff(M, j, j) = un; /* P-part */ row = d + 1; Q = P; for (i = 1; i < delta; i++) { for (j = 0; j < d; j++,row++) for (l = j + 1; l <= row; l++) coeff(M, l, row) = lmulii(Xpowers[l-1], (GEN)Q[l-j+1]); Q = RgX_mul(Q, P); } for (j = 0; j < t; row++, j++) for (l = j + 1; l <= row; l++) coeff(M, l, row) = lmulii(Xpowers[l-1], (GEN)Q[l-j+1]); /* N-part */ row = dim - t; N0 = N; while (row >= 1) { for (j = 0; j < d; j++,row--) for (l = 1; l <= row; l++) coeff(M, l, row) = lmulii(gmael(M, row, l), N0); if (row >= 1) N0 = mulii(N0, N); } /* Z is the upper bound for the L^1 norm of the polynomial, ie. N^delta if B = N, B^delta otherwise */ if (B != N) Z = gpowgs(B, delta); else Z = N0; if (DEBUGLEVEL >= 2) { if (DEBUGLEVEL >= 6) fprintferr("Matrix to be reduced:\n%Z\n", M); fprintferr("Entering LLL\nbitsize bound: %ld\n", expi(Z)); fprintferr("expected shvector bitsize: %ld\n", expi(dethnf_i(M))/dim); } sh = lllint_fp_ip(M, 4); short_pol = (GEN)sh[1]; nsp = gzero; for (j = 1; j <= dim; j++) nsp = addii(nsp, absi((GEN)short_pol[j])); if (DEBUGLEVEL >= 2) { fprintferr("Candidate: %Z\n", short_pol); fprintferr("bitsize Norm: %ld\n", expi(nsp)); fprintferr("bitsize bound: %ld\n", expi(mulsi(bnd, Z))); } if (cmpii(nsp, mulsi(bnd, Z)) < 0) break; /* SUCCESS */ /* Failed with the precomputed or supplied value */ t++; if (t == d) { delta++; t = 1; } if (DEBUGLEVEL >= 2) fprintferr("Increasing dim, delta = %d t = %d\n", delta, t); } bnd = itos(divii(nsp, Z)) + 1; while (!signe(short_pol[dim])) dim--; R = cgetg(dim + 2, t_POL); R[1] = P[1]; for (j = 1; j <= dim; j++) R[j+1] = (long)diviiexact((GEN)short_pol[j], Xpowers[j-1]); R[2] = (long)subii((GEN)R[2], mulsi(bnd - 1, N0)); sol = cgetg(1, t_VEC); for (i = -bnd + 1; i < bnd; i++) { r = nfrootsQ(R); if (DEBUGLEVEL >= 2) fprintferr("Roots: %Z\n", r); for (j = 1; j < lg(r); j++) { z = (GEN)r[j]; tst = gcdii(FpX_eval(P, z, N), N); if (cmpii(tst, B) >= 0) /* We have found a factor of N >= B */ { for (l = 1; l < lg(sol) && !egalii(z, (GEN)sol[l]); l++) /*empty*/; if (l == lg(sol)) sol = concatsp(sol, z); } } if (i < bnd) R[2] = (long)addii((GEN)R[2], Z); } return gerepilecopy(ltop, sol);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8a4d3af5b53a4748031f6f6ddb8816d13214c33e/bibli1.c/buggy/src/basemath/bibli1.c |
|
row = d + 1; Q = P; | if (delta) row = d + 1; else row = 0; Q = P; | zncoppersmith(GEN P0, GEN N, GEN X, GEN B){ GEN Q, R, N0, M, sh, short_pol, *Xpowers, z, r, sol, nsp, P, tst, Z; int delta, ltop = avma, i, j, row, d, l, dim, t, bnd = 10; if (typ(P0) != t_POL || typ(N) != t_INT) err(typeer, "Coppersmith"); if (typ(X) != t_INT) X = gfloor(X); if (!B) B = N; else { bnd = 1; /* bnd-hack is only for the case B = N */ if (typ(B) != t_INT) B = gfloor(B); } P = dummycopy(P0); d = degpol(P); if (!gcmp1((GEN)P[d+2])) { P[d+2] = (long)bezout((GEN)P[d+2], N, &z, &r); for (j = 0; j < d; j++) P[j+2] = lmodii(mulii((GEN)P[j+2], z), N); } if (DEBUGLEVEL >= 2) fprintferr("Modified P: %Z\n", P); choose_params(P, N, X, B, &delta, &t); if (DEBUGLEVEL >= 2) fprintferr("Init: trying delta = %d, t = %d\n", delta, t); for(;;) { dim = d * delta + t; /* TODO: In case of failure do not recompute the full vector */ Xpowers = (GEN*)new_chunk(dim + 1); Xpowers[0] = gun; for (j = 1; j <= dim; j++) Xpowers[j] = gmul(Xpowers[j-1], X); /* TODO: in case of failure, use the part of the matrix already computed */ M = cgetg(dim + 1, t_MAT); for (j = 1; j <= dim; j++) M[j] = (long)zerocol(dim); /* Rows of M correspond to the polynomials * N^delta, N^delta Xi, ... N^delta (Xi)^d-1, * N^(delta-1)P(Xi), N^(delta-1)XiP(Xi), ... N^(delta-1)P(Xi)(Xi)^d-1, * ... * P(Xi)^delta, XiP(Xi)^delta, ..., P(Xi)^delta(Xi)^t-1 */ for (j = 1; j <= d; j++) coeff(M, j, j) = (long)Xpowers[j-1]; for ( ; j <= dim; j++) coeff(M, j, j) = un; /* P-part */ row = d + 1; Q = P; for (i = 1; i < delta; i++) { for (j = 0; j < d; j++,row++) for (l = j + 1; l <= row; l++) coeff(M, l, row) = lmulii(Xpowers[l-1], (GEN)Q[l-j+1]); Q = RgX_mul(Q, P); } for (j = 0; j < t; row++, j++) for (l = j + 1; l <= row; l++) coeff(M, l, row) = lmulii(Xpowers[l-1], (GEN)Q[l-j+1]); /* N-part */ row = dim - t; N0 = N; while (row >= 1) { for (j = 0; j < d; j++,row--) for (l = 1; l <= row; l++) coeff(M, l, row) = lmulii(gmael(M, row, l), N0); if (row >= 1) N0 = mulii(N0, N); } /* Z is the upper bound for the L^1 norm of the polynomial, ie. N^delta if B = N, B^delta otherwise */ if (B != N) Z = gpowgs(B, delta); else Z = N0; if (DEBUGLEVEL >= 2) { if (DEBUGLEVEL >= 6) fprintferr("Matrix to be reduced:\n%Z\n", M); fprintferr("Entering LLL\nbitsize bound: %ld\n", expi(Z)); fprintferr("expected shvector bitsize: %ld\n", expi(dethnf_i(M))/dim); } sh = lllint_fp_ip(M, 4); short_pol = (GEN)sh[1]; nsp = gzero; for (j = 1; j <= dim; j++) nsp = addii(nsp, absi((GEN)short_pol[j])); if (DEBUGLEVEL >= 2) { fprintferr("Candidate: %Z\n", short_pol); fprintferr("bitsize Norm: %ld\n", expi(nsp)); fprintferr("bitsize bound: %ld\n", expi(mulsi(bnd, Z))); } if (cmpii(nsp, mulsi(bnd, Z)) < 0) break; /* SUCCESS */ /* Failed with the precomputed or supplied value */ t++; if (t == d) { delta++; t = 1; } if (DEBUGLEVEL >= 2) fprintferr("Increasing dim, delta = %d t = %d\n", delta, t); } bnd = itos(divii(nsp, Z)) + 1; while (!signe(short_pol[dim])) dim--; R = cgetg(dim + 2, t_POL); R[1] = P[1]; for (j = 1; j <= dim; j++) R[j+1] = (long)diviiexact((GEN)short_pol[j], Xpowers[j-1]); R[2] = (long)subii((GEN)R[2], mulsi(bnd - 1, N0)); sol = cgetg(1, t_VEC); for (i = -bnd + 1; i < bnd; i++) { r = nfrootsQ(R); if (DEBUGLEVEL >= 2) fprintferr("Roots: %Z\n", r); for (j = 1; j < lg(r); j++) { z = (GEN)r[j]; tst = gcdii(FpX_eval(P, z, N), N); if (cmpii(tst, B) >= 0) /* We have found a factor of N >= B */ { for (l = 1; l < lg(sol) && !egalii(z, (GEN)sol[l]); l++) /*empty*/; if (l == lg(sol)) sol = concatsp(sol, z); } } if (i < bnd) R[2] = (long)addii((GEN)R[2], Z); } return gerepilecopy(ltop, sol);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8a4d3af5b53a4748031f6f6ddb8816d13214c33e/bibli1.c/buggy/src/basemath/bibli1.c |
if ( !_POSIX_signals_Pending ) | if ( !_POSIX_signals_Pending && _Thread_Do_post_task_switch_extension ) | void _POSIX_signals_Clear_process_signals( sigset_t mask){ ISR_Level level; _ISR_Disable( level ); _POSIX_signals_Pending &= ~mask; if ( !_POSIX_signals_Pending ) _Thread_Do_post_task_switch_extension--; _ISR_Enable( level );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/847375f3ad4af55b9bd4d8a6daff313165de5fd8/psignal.c/buggy/cpukit/posix/src/psignal.c |
/* * Since we made a union of these, only one test is necessary but this is * safer. */ assert( _POSIX_signals_Vectors[ signo ].sa_handler || _POSIX_signals_Vectors[ signo ].sa_sigaction ); | boolean _POSIX_signals_Check_signal( POSIX_API_Control *api, int signo, boolean is_global){ sigset_t mask; ISR_Level level; boolean do_callout; siginfo_t *siginfo = NULL; /* really needs to be set below */ siginfo_t siginfo_struct; mask = signo_to_mask( signo ); do_callout = FALSE; _ISR_Disable( level ); if ( is_global ) { ; /* XXX check right place for thread versus global */ } else { if ( mask & (api->signals_pending & ~api->signals_blocked ) ) { api->signals_pending &= ~mask; do_callout = TRUE; } } _ISR_Enable( level ); if ( !do_callout ) return FALSE; switch ( _POSIX_signals_Vectors[ signo ].sa_flags ) { case SA_SIGINFO: assert( 0 ); /* XXX we haven't completely implemented this yet */ if ( !is_global ) { siginfo = &siginfo_struct; siginfo->si_signo = signo; siginfo->si_code = SI_USER; siginfo->si_value.sival_int = 0; } (*_POSIX_signals_Vectors[ signo ].sa_sigaction)( signo, siginfo, NULL /* context is undefined per 1003.1b-1993, p. 66 */ ); break; default: (*_POSIX_signals_Vectors[ signo ].sa_handler)( signo ); break; } return TRUE;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/98ed15e30fffa76a0dc298e1d68cf21a70f90bae/psignal.c/buggy/cpukit/posix/src/psignal.c |
|
xinit = x; | xinit = x; | lllgram_marked(int MARKED, GEN x, long alpha, long flag, long prec){ GEN xinit,L,h,B,L1,QR; long retry = 2, l, i, j, k, k1, lx=lg(x), n, kmax, KMAX; gpmem_t av0 = avma, av, lim; long last_prec; if (typ(x) != t_MAT) err(typeer,"lllgram"); n=lx-1; if (n && lg((GEN)x[1])!=lx) err(mattype1,"lllgram"); if (n<=1) return idmat(n); QR = cgetr(DEFAULTPREC); affsr(alpha-1,QR); QR = divrs(QR,alpha); xinit = x; av = avma; lim = stack_lim(av,1); for (k=2,j=1; j<lx; j++) { GEN p1=(GEN)x[j]; for (i=1; i<=j; i++) if (typ(p1[i]) == t_REAL) { l = lg(p1[i]); if (l>k) k=l; } } if (k == 2) { if (!prec) return lllgramint(x); x = gmul(x, realun(prec+1)); } else { if (prec < k) prec = k; x = gprec_w(x, prec+1); } /* kmax = maximum column index attained during this run * KMAX = same over all runs (after PRECPB) */ kmax = KMAX = 1;PRECPB: switch(retry--) { case 2: h = idmat(n); break; /* entry */ case 1: if (kmax > 2) { /* some progress but precision loss, try again */ prec = (prec<<1)-2; kmax = 1; if (DEBUGLEVEL > 3) fprintferr("\n"); if (DEBUGLEVEL) err(warnprec,"lllgramintern",prec); x = qf_base_change(gprec_w(xinit,prec),h,1); gerepileall(av,2,&h,&x); if (DEBUGLEVEL) err(warner,"lllgramintern starting over"); break; } /* fall through */ case 0: /* give up */ if (DEBUGLEVEL > 3) fprintferr("\n"); if (DEBUGLEVEL) err(warner,"lllgramintern giving up"); if (flag) { avma=av; return NULL; } if (DEBUGLEVEL) outerr(xinit); err(lllger3); } last_prec = prec; L=cgetg(lx,t_MAT); B=cgetg(lx,t_COL); for (j=1; j<lx; j++) { L[j] = (long)zerocol(n); B[j] = zero; } k=2; B[1]=coeff(x,1,1); if (gcmp0((GEN)B[1])) { if (flag) return NULL; err(lllger3); } if (DEBUGLEVEL>5) fprintferr("k ="); for(;;) { if (k>kmax) { kmax = k; if (KMAX < kmax) KMAX = kmax; if (DEBUGLEVEL>3) {fprintferr(" K%ld",k);flusherr();} if (!get_Gram_Schmidt(x,L,B,k)) goto PRECPB; } else if (DEBUGLEVEL>5) fprintferr(" %ld",k); L1 = gcoeff(L,k,k-1); if (typ(L1) == t_REAL && (2*gexpo(L1) > bit_accuracy(lg(L1)) || 2*lg(L1) < last_prec)) { last_prec = lg(L1); if (DEBUGLEVEL>3) fprintferr("\nRecomputing Gram-Schmidt, kmax = %ld, prec was %ld\n", kmax,last_prec); for (k1=1; k1<=kmax; k1++) if (!get_Gram_Schmidt(x,L,B,k1)) goto PRECPB; } if (k != MARKED) RED(k,k-1, x,h,L,KMAX); if (do_SWAP(x,h,L,B,kmax,k,QR)) { if (MARKED == k) MARKED = k-1; else if (MARKED == k-1) MARKED = k; if (!B[k]) goto PRECPB; if (k>2) k--; } else { if (k != MARKED) for (l=k-2; l; l--) RED(k,l, x,h,L,KMAX); if (++k > n) break; } if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) { if (DEBUGLEVEL > 3) fprintferr("\n"); err(warnmem,"lllgram"); } gerepileall(av,4,&B,&L,&h,&x); } } if (DEBUGLEVEL>3) fprintferr("\n"); if (MARKED && MARKED != 1) swap(h[1], h[MARKED]); return gerepilecopy(av0, h);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/87b498f0e4b8ff8c197c46ce153c7a1251370828/bibli1.c/clean/src/basemath/bibli1.c |