rem
stringlengths 0
274k
| add
stringlengths 0
169k
| context
stringlengths 9
471k
|
---|---|---|
Objects_Name name, | rtems_name name, | void _Region_MP_Send_process_packet ( Region_MP_Remote_operations operation, Objects_Id region_id, Objects_Name name, Objects_Id proxy_id){ Region_MP_Packet *the_packet; unsigned32 node; switch ( operation ) { case REGION_MP_ANNOUNCE_CREATE: case REGION_MP_ANNOUNCE_DELETE: case REGION_MP_EXTRACT_PROXY: the_packet = _Region_MP_Get_packet(); the_packet->Prefix.the_class = RTEMS_MP_PACKET_REGION; the_packet->Prefix.length = sizeof ( Region_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( Region_MP_Packet ); the_packet->operation = operation; the_packet->Prefix.id = region_id; the_packet->name = name; the_packet->proxy_id = proxy_id; if ( operation == REGION_MP_EXTRACT_PROXY ) node = rtems_get_node( region_id ); else node = MPCI_ALL_NODES; _MPCI_Send_process_packet( node, &the_packet->Prefix ); break; case REGION_MP_GET_SEGMENT_REQUEST: case REGION_MP_GET_SEGMENT_RESPONSE: case REGION_MP_RETURN_SEGMENT_REQUEST: case REGION_MP_RETURN_SEGMENT_RESPONSE: break; }} |
gb->bornesol = gerepileupto(ltop, ceil_safe(borneroots)); | gb->bornesol = gerepileupto(ltop, ceil_safe(mulrs(borneroots,2))); | galoisborne(GEN T, GEN dn, struct galois_borne *gb, long ppp){ gpmem_t ltop = avma, av2; GEN borne, borneroots, borneabs; int i, j; int n; GEN L, M, z, prep, den; long prec; den = initgaloisborne(T,dn, &L,&prep,NULL,&prec); if (!dn) den = gclone(den); M = vandermondeinverse(L, gmul(T, realun(prec)), den, prep); if (DEBUGLEVEL>=4) genmsgtimer(3,"vandermondeinverse"); borne = realzero(prec); n = degpol(T); for (i = 1; i <= n; i++) { z = gzero; for (j = 1; j <= n; j++) z = gadd(z, gabs(gcoeff(M,i,j), prec)); if (gcmp(z, borne) > 0) borne = z; } borneroots = realzero(prec); for (i = 1; i <= n; i++) { z = gabs((GEN) L[i], prec); if (gcmp(z, borneroots) > 0) borneroots = z; } borneabs = addsr(1, gmulsg(n, gpowgs(borneroots, n/ppp))); /*if (ppp == 1) borneabs = addsr(1, gmulsg(n, gpowgs(borneabs, 2)));*/ borneroots = addsr(1, gmul(borne, borneroots)); av2 = avma; /*We use d-1 test, so we must overlift to 2^BITS_IN_LONG*/ gb->valsol = logint(gmul2n(borneroots,2+BITS_IN_LONG), gb->l,NULL); gb->valabs = logint(gmul2n(borneabs,2), gb->l,NULL); gb->valabs = max(gb->valsol,gb->valabs); if (DEBUGLEVEL >= 4) fprintferr("GaloisConj:val1=%ld val2=%ld\n", gb->valsol, gb->valabs); avma = av2; gb->bornesol = gerepileupto(ltop, ceil_safe(borneroots)); if (DEBUGLEVEL >= 9) fprintferr("GaloisConj: Bound %Z\n",borneroots); gb->ladicsol = gpowgs(gb->l, gb->valsol); gb->ladicabs = gpowgs(gb->l, gb->valabs); gb->lbornesol = subii(gb->ladicsol,gb->bornesol); if (!dn) { dn = icopy(den); gunclone(den); } return dn;} |
tabefin = cgetg(lv,t_VECSMALL); | inittabs(int lv){ int i; tabaall = (GEN*)cgetg(lv,t_VECSMALL); tabtall = (GEN*)cgetg(lv,t_VECSMALL); tabcyc = (GEN*)cgetg(lv,t_VEC); tabefin = cgetg(lv,t_VECSMALL); tabE = cgetg(lv,t_VEC); tabTH= cgetg(lv,t_VEC); tabeta=cgetg(lv,t_VEC); sgt = cgetg(lv,t_VECSMALL); ctsgt= cgetg(lv,t_VECSMALL); for (i=1; i<lv; i++) sgt[i] = ctsgt[i] = 0;} |
|
*d = atol(s); | *d = get_int(s, 0); | testint(char *s, long *d){ if (!s) return; *d = atol(s); if (*d <= 0) err(talker,"arguments must be positive integers");} |
GEN V=NULL; long n=lg(O[1])*2; GEN LN=cgetg(n,t_MAT); GEN Ll=cgetg(n,t_MAT); long i,nb,ok=0; for(i=1, nb=1; i<n; i++, nb*=4) | const long n=(BITS_IN_LONG>>1)-1; GEN NS=cgetg(n+1,t_MAT); GEN sym=NULL, W=cgetg(n+1,t_VECSMALL); long i, e=1; if (DEBUGLEVEL>=4) fprintferr("FixedField: Size: %ldx%ld\n",lg(O)-1,lg(O[1])-1); for(i=1;!sym && i<=n; i++) | fixedfieldsympol(GEN O, GEN mod, GEN l, GEN p, long v){ pari_sp ltop=avma; GEN V=NULL; long n=lg(O[1])*2; GEN LN=cgetg(n,t_MAT); GEN Ll=cgetg(n,t_MAT); long i,nb,ok=0; for(i=1, nb=1; i<n; i++, nb*=4) { gel(LN,i) = sympol_eval_newtonsum(i,O,mod); gel(Ll,i) = FpC_red(gel(LN,i),l); if (DEBUGLEVEL>=6) fprintferr("FixedField: LN[%d]=%Z \n",i,Ll[i]); ok = (ok || fixedfieldtests(Ll,i)); if (ok) if ((V=fixedfieldsurmer(O,mod,l,p,v,LN,i,nb))) { if (DEBUGLEVEL>=4) pariputsf("FixedField: Sym: %Z\n",gel(V,1)); return gerepilecopy(ltop,V); } } err(talker,"p too small in fixedfieldsympol"); return NULL;} |
gel(LN,i) = sympol_eval_newtonsum(i,O,mod); gel(Ll,i) = FpC_red(gel(LN,i),l); if (DEBUGLEVEL>=6) fprintferr("FixedField: LN[%d]=%Z \n",i,Ll[i]); ok = (ok || fixedfieldtests(Ll,i)); if (ok) if ((V=fixedfieldsurmer(O,mod,l,p,v,LN,i,nb))) { if (DEBUGLEVEL>=4) pariputsf("FixedField: Sym: %Z\n",gel(V,1)); return gerepilecopy(ltop,V); } | GEN L = sympol_eval_newtonsum(e++, O, mod); if (lg(O)>2) while (vec_isconst(L)) L = sympol_eval_newtonsum(e++, O, mod); W[i] = e-1; gel(NS,i) = L; if (sympol_is1to1_lg(NS,i+1)) sym=fixedfieldsurmer(O,mod,l,p,v,NS,vecsmall_shorten(W,i)); | fixedfieldsympol(GEN O, GEN mod, GEN l, GEN p, long v){ pari_sp ltop=avma; GEN V=NULL; long n=lg(O[1])*2; GEN LN=cgetg(n,t_MAT); GEN Ll=cgetg(n,t_MAT); long i,nb,ok=0; for(i=1, nb=1; i<n; i++, nb*=4) { gel(LN,i) = sympol_eval_newtonsum(i,O,mod); gel(Ll,i) = FpC_red(gel(LN,i),l); if (DEBUGLEVEL>=6) fprintferr("FixedField: LN[%d]=%Z \n",i,Ll[i]); ok = (ok || fixedfieldtests(Ll,i)); if (ok) if ((V=fixedfieldsurmer(O,mod,l,p,v,LN,i,nb))) { if (DEBUGLEVEL>=4) pariputsf("FixedField: Sym: %Z\n",gel(V,1)); return gerepilecopy(ltop,V); } } err(talker,"p too small in fixedfieldsympol"); return NULL;} |
err(talker,"p too small in fixedfieldsympol"); return NULL; | if (!sym) err(talker,"p too small in fixedfieldsympol"); if (DEBUGLEVEL>=2) fprintferr("FixedField: Found: %Z\n",gel(sym,1)); return gerepilecopy(ltop,sym); | fixedfieldsympol(GEN O, GEN mod, GEN l, GEN p, long v){ pari_sp ltop=avma; GEN V=NULL; long n=lg(O[1])*2; GEN LN=cgetg(n,t_MAT); GEN Ll=cgetg(n,t_MAT); long i,nb,ok=0; for(i=1, nb=1; i<n; i++, nb*=4) { gel(LN,i) = sympol_eval_newtonsum(i,O,mod); gel(Ll,i) = FpC_red(gel(LN,i),l); if (DEBUGLEVEL>=6) fprintferr("FixedField: LN[%d]=%Z \n",i,Ll[i]); ok = (ok || fixedfieldtests(Ll,i)); if (ok) if ((V=fixedfieldsurmer(O,mod,l,p,v,LN,i,nb))) { if (DEBUGLEVEL>=4) pariputsf("FixedField: Sym: %Z\n",gel(V,1)); return gerepilecopy(ltop,V); } } err(talker,"p too small in fixedfieldsympol"); return NULL;} |
fixedfieldsurmer(GEN O, GEN mod, GEN l, GEN p, long v, GEN LN, long n, long m) | fixedfieldsurmer(GEN O, GEN mod, GEN l, GEN p, long v, GEN NS, GEN W) | fixedfieldsurmer(GEN O, GEN mod, GEN l, GEN p, long v, GEN LN, long n, long m){ long i,j; const long step=4; GEN sym=cgetg(n+1,t_VECSMALL); for (j=1;j<n;j++) sym[j]=step; sym[n]=0; for (i=0;i<m;i++) { pari_sp av=avma; GEN L,P; for (j=1;sym[j]==step;j++) sym[j]=0; sym[j]++; if (DEBUGLEVEL>=4) fprintferr("FixedField: Sym: %Z\n",sym); L=sympol_eval(sym, O, mod); if (L==gen_0 || !fixedfieldtest(FpC_red(L,l))) continue; P=FpX_center(FpV_roots_to_pol(L,mod,v),mod); if (!p || FpX_is_squarefree(P,p)) return mkvec3(sym,L,P); avma=av; } return NULL;} |
const long step=4; | const long step=3; long n=lg(W)-1; long m=1<<((n-1)<<1); | fixedfieldsurmer(GEN O, GEN mod, GEN l, GEN p, long v, GEN LN, long n, long m){ long i,j; const long step=4; GEN sym=cgetg(n+1,t_VECSMALL); for (j=1;j<n;j++) sym[j]=step; sym[n]=0; for (i=0;i<m;i++) { pari_sp av=avma; GEN L,P; for (j=1;sym[j]==step;j++) sym[j]=0; sym[j]++; if (DEBUGLEVEL>=4) fprintferr("FixedField: Sym: %Z\n",sym); L=sympol_eval(sym, O, mod); if (L==gen_0 || !fixedfieldtest(FpC_red(L,l))) continue; P=FpX_center(FpV_roots_to_pol(L,mod,v),mod); if (!p || FpX_is_squarefree(P,p)) return mkvec3(sym,L,P); avma=av; } return NULL;} |
if (DEBUGLEVEL>=4) fprintferr("FixedField: Sym: %Z\n",sym); L=sympol_eval(sym, O, mod); if (L==gen_0 || !fixedfieldtest(FpC_red(L,l))) continue; | if (DEBUGLEVEL>=6) fprintferr("FixedField: Sym: %Z\n",sym); L=sympol_eval(sym,NS); if (!vec_is1to1(FpC_red(L,l))) continue; | fixedfieldsurmer(GEN O, GEN mod, GEN l, GEN p, long v, GEN LN, long n, long m){ long i,j; const long step=4; GEN sym=cgetg(n+1,t_VECSMALL); for (j=1;j<n;j++) sym[j]=step; sym[n]=0; for (i=0;i<m;i++) { pari_sp av=avma; GEN L,P; for (j=1;sym[j]==step;j++) sym[j]=0; sym[j]++; if (DEBUGLEVEL>=4) fprintferr("FixedField: Sym: %Z\n",sym); L=sympol_eval(sym, O, mod); if (L==gen_0 || !fixedfieldtest(FpC_red(L,l))) continue; P=FpX_center(FpV_roots_to_pol(L,mod,v),mod); if (!p || FpX_is_squarefree(P,p)) return mkvec3(sym,L,P); avma=av; } return NULL;} |
return mkvec3(sym,L,P); | return mkvec3(mkvec2(sym,W),L,P); | fixedfieldsurmer(GEN O, GEN mod, GEN l, GEN p, long v, GEN LN, long n, long m){ long i,j; const long step=4; GEN sym=cgetg(n+1,t_VECSMALL); for (j=1;j<n;j++) sym[j]=step; sym[n]=0; for (i=0;i<m;i++) { pari_sp av=avma; GEN L,P; for (j=1;sym[j]==step;j++) sym[j]=0; sym[j]++; if (DEBUGLEVEL>=4) fprintferr("FixedField: Sym: %Z\n",sym); L=sympol_eval(sym, O, mod); if (L==gen_0 || !fixedfieldtest(FpC_red(L,l))) continue; P=FpX_center(FpV_roots_to_pol(L,mod,v),mod); if (!p || FpX_is_squarefree(P,p)) return mkvec3(sym,L,P); avma=av; } return NULL;} |
return | return (rtems_status_code) | rtems_status_code _Event_MP_Send_request_packet ( Event_MP_Remote_operations operation, Objects_Id event_id, rtems_event_set event_in){ Event_MP_Packet *the_packet; switch ( operation ) { case EVENT_MP_SEND_REQUEST: the_packet = _Event_MP_Get_packet(); the_packet->Prefix.the_class = MP_PACKET_EVENT; the_packet->Prefix.length = sizeof ( Event_MP_Packet ); the_packet->Prefix.to_convert = sizeof ( Event_MP_Packet ); the_packet->operation = operation; the_packet->Prefix.id = event_id; the_packet->event_in = event_in; return _MPCI_Send_request_packet( rtems_get_node( event_id ), &the_packet->Prefix, STATES_READY ); break; case EVENT_MP_SEND_RESPONSE: break; } /* * The following line is included to satisfy compilers which * produce warnings when a function does not end with a return. */ return RTEMS_SUCCESSFUL;} |
long r, j, k, k2, d = n - m, d2 = d<<1; | const long d = n - m, d2 = d<<1, r = (m+1)>>1; long j, k, k2; | polzagreel(long n, long m, long prec){ long r, j, k, k2, d = n - m, d2 = d<<1; pari_sp av = avma; GEN Bx, g, h, v, b, s; if (d <= 0 || m < 0) return gzero; Bx = coefs_to_pol(3, gun, gun, gzero); /* x + x^2 */ v = cgetg(d+1,t_VEC); g = cgetg(d+1,t_VEC); v[d] = un; b = stor(d2, prec); g[d] = (long)b; for (k = 1; k < d; k++) { v[d-k] = un; for (j=1; j<k; j++) v[d-k+j] = laddii((GEN)v[d-k+j], (GEN)v[d-k+j+1]); /* v[d-k+j] = binom(k, j), j = 0..k */ k2 = k+k; b = divri(mulri(b,mulss(d2-k2+1,d2-k2)), mulss(k2,k2+1)); for (j=1; j<=k; j++) g[d-k+j] = lmpadd((GEN)g[d-k+j], mulri(b,(GEN)v[d-k+j])); g[d-k] = (long)b; } r = (m+1)>>1; g = gmul(vec_to_pol(g,0), gpowgs(Bx,r)); for (j=0; j<=r; j++) { if (j) g = derivpol(g); if (j || !(m&1)) { h = cgetg(n+3,t_POL); h[1] = evalsigne(1); h[2] = g[2]; for (k=1; k<n; k++) h[k+2] = ladd(gmulsg(k+k+1,(GEN)g[k+2]), gmulsg(k<<1,(GEN)g[k+1])); h[n+2] = lmulsg(n<<1, (GEN)g[n+1]); g = h; } } g = m? gmul2n(g,(m-1)>>1): gmul2n(g,-1); s = mulsi(d, mpfact(m+1)); return gerepileupto(av, gdiv(g,s));} |
r = (m+1)>>1; | polzagreel(long n, long m, long prec){ long r, j, k, k2, d = n - m, d2 = d<<1; pari_sp av = avma; GEN Bx, g, h, v, b, s; if (d <= 0 || m < 0) return gzero; Bx = coefs_to_pol(3, gun, gun, gzero); /* x + x^2 */ v = cgetg(d+1,t_VEC); g = cgetg(d+1,t_VEC); v[d] = un; b = stor(d2, prec); g[d] = (long)b; for (k = 1; k < d; k++) { v[d-k] = un; for (j=1; j<k; j++) v[d-k+j] = laddii((GEN)v[d-k+j], (GEN)v[d-k+j+1]); /* v[d-k+j] = binom(k, j), j = 0..k */ k2 = k+k; b = divri(mulri(b,mulss(d2-k2+1,d2-k2)), mulss(k2,k2+1)); for (j=1; j<=k; j++) g[d-k+j] = lmpadd((GEN)g[d-k+j], mulri(b,(GEN)v[d-k+j])); g[d-k] = (long)b; } r = (m+1)>>1; g = gmul(vec_to_pol(g,0), gpowgs(Bx,r)); for (j=0; j<=r; j++) { if (j) g = derivpol(g); if (j || !(m&1)) { h = cgetg(n+3,t_POL); h[1] = evalsigne(1); h[2] = g[2]; for (k=1; k<n; k++) h[k+2] = ladd(gmulsg(k+k+1,(GEN)g[k+2]), gmulsg(k<<1,(GEN)g[k+1])); h[n+2] = lmulsg(n<<1, (GEN)g[n+1]); g = h; } } g = m? gmul2n(g,(m-1)>>1): gmul2n(g,-1); s = mulsi(d, mpfact(m+1)); return gerepileupto(av, gdiv(g,s));} |
|
g = m? gmul2n(g,(m-1)>>1): gmul2n(g,-1); | g = gmul2n(g, r-1); | polzagreel(long n, long m, long prec){ long r, j, k, k2, d = n - m, d2 = d<<1; pari_sp av = avma; GEN Bx, g, h, v, b, s; if (d <= 0 || m < 0) return gzero; Bx = coefs_to_pol(3, gun, gun, gzero); /* x + x^2 */ v = cgetg(d+1,t_VEC); g = cgetg(d+1,t_VEC); v[d] = un; b = stor(d2, prec); g[d] = (long)b; for (k = 1; k < d; k++) { v[d-k] = un; for (j=1; j<k; j++) v[d-k+j] = laddii((GEN)v[d-k+j], (GEN)v[d-k+j+1]); /* v[d-k+j] = binom(k, j), j = 0..k */ k2 = k+k; b = divri(mulri(b,mulss(d2-k2+1,d2-k2)), mulss(k2,k2+1)); for (j=1; j<=k; j++) g[d-k+j] = lmpadd((GEN)g[d-k+j], mulri(b,(GEN)v[d-k+j])); g[d-k] = (long)b; } r = (m+1)>>1; g = gmul(vec_to_pol(g,0), gpowgs(Bx,r)); for (j=0; j<=r; j++) { if (j) g = derivpol(g); if (j || !(m&1)) { h = cgetg(n+3,t_POL); h[1] = evalsigne(1); h[2] = g[2]; for (k=1; k<n; k++) h[k+2] = ladd(gmulsg(k+k+1,(GEN)g[k+2]), gmulsg(k<<1,(GEN)g[k+1])); h[n+2] = lmulsg(n<<1, (GEN)g[n+1]); g = h; } } g = m? gmul2n(g,(m-1)>>1): gmul2n(g,-1); s = mulsi(d, mpfact(m+1)); return gerepileupto(av, gdiv(g,s));} |
filltabs(Cache *C, Cache *Cp, Red *R, int p, int pk, ulong ltab) | filltabs(Cache *C, Cache *Cp, Red *R, int p, int pk, long ltab) | filltabs(Cache *C, Cache *Cp, Red *R, int p, int pk, ulong ltab){ pari_sp av; int i, j; long e; GEN tabt, taba, m; C->cyc = cyclo(pk,0); if (p > 2) { int LE = pk - pk/p + 1; GEN E = cgetg(LE, t_VECSMALL), eta = cgetg(pk+1,t_VEC); for (i=1,j=0; i<pk; i++) if (i%p) E[++j] = i; C->E = E; for (i=1; i<=pk; i++) { GEN z = FpX_res(gpowgs(polx[0],i-1), C->cyc, R->N); eta[i] = (long)centermod_i(z, R->N, R->N2); } C->eta = eta; } else if (pk >= 8) { int LE = (pk>>2) + 1; GEN E = cgetg(LE, t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j] = i; C->E = E; } if (pk > 2 && smodis(R->N,pk) == 1) { GEN vpa, p1, p2, p3, a2 = NULL, a = finda(Cp, R->N, pk, p); int jj, ph = pk - pk/p; vpa = cgetg(ph+1,t_COL); vpa[1] = (long)a; if (pk > p) a2 = centermodii(sqri(a), R->N, R->N2); jj = 1; for (i=2; i<pk; i++) /* vpa = { a^i, (i,p) = 1 } */ if (i%p) { GEN z = mulii((i%p==1) ? a2 : a, (GEN)vpa[jj]); vpa[++jj] = (long)centermodii(z , R->N, R->N2); } if (!gcmp1( centermodii( mulii(a, (GEN)vpa[ph]), R->N, R->N2) )) return 0; p1 = cgetg(ph+1,t_MAT); p2 = cgetg(ph+1,t_COL); p1[1] = (long)p2; for (i=1; i<=ph; i++) p2[i] = un; j = 2; p1[j] = (long)vpa; p3 = vpa; for (j++; j <= ph; j++) { p2 = cgetg(ph+1,t_COL); p1[j] = (long)p2; for (i=1; i<=ph; i++) p2[i] = (long)centermodii(mulii((GEN)vpa[i],(GEN)p3[i]), R->N, R->N2); p3 = p2; } C->matvite = p1; C->matinvvite = FpM_inv(p1, R->N); } tabt = cgetg(ltab+1, t_VECSMALL); taba = cgetg(ltab+1, t_VECSMALL); av = avma; m = divis(R->N, pk); for (e=1; e<=ltab && signe(m); e++) { long s = vali(m); m = shifti(m,-s); tabt[e] = e==1? s: s + R->k; taba[e] = signe(m)? ((modBIL(m) & R->mask)+1)>>1: 0; m = shifti(m, -R->k); } setlg(taba, e); C->aall = taba; setlg(tabt, e); C->tall = tabt; avma = av; return 1;} |
TOP = (long)top; | read_opt(long argc, char **argv){ char *b=NULL, *p=NULL, *s=NULL, **pre; int i=1, initrc=1; long TOP; pari_outfile=stderr; while (i<argc) { char *t = argv[i++]; if (*t++ != '-') usage(argv[0]); switch(*t++) { case 'b': b = read_arg(&i,t,argc,argv); break; case 'p': p = read_arg(&i,t,argc,argv); break; case 's': s = read_arg(&i,t,argc,argv); break; case 'e': if (strncmp(t,"macs",4)) usage(argv[0]); under_emacs = 1; break; case 'q': quiet_mode = 1; break; case 't': if (strncmp(t,"est",3)) usage(argv[0]); disable_color = 1; test_mode = 1; /* fall through */ case 'f': initrc = 0; break; case '-': if (strcmp(t, "version") == 0) { print_version(); exit(0); } if (strcmp(t, "texmacs") == 0) { under_texmacs = 1; break; } /* fall through */ default: usage(argv[0]); } } if (under_texmacs) tm_start_output(); pre = initrc? gp_initrc(): NULL; /* override the values from gprc */ testint(b, &paribufsize); if (paribufsize < 10) paribufsize = 10; testint(p, &primelimit); testint(s, &TOP); top = (ulong)TOP; if (under_emacs || under_texmacs) disable_color=1; pari_outfile=stdout; return pre;} |
|
if ((status = apr_pool_create(&tmppool, request->respool)) != APR_SUCCESS) { return status; } | apr_pool_clear(tmppool); | static apr_status_t read_from_connection(serf_connection_t *conn){ apr_status_t status; apr_pool_t *tmppool; /* Whatever is coming in on the socket corresponds to the first request * on our chain. */ serf_request_t *request = conn->requests; /* assert: request != NULL */ /* Invoke response handlers until we have no more work. */ while (1) { if ((status = apr_pool_create(&tmppool, request->respool)) != APR_SUCCESS) { return status; } /* If the request doesn't have a response bucket, then call the * acceptor to get one created. */ if (request->resp_bkt == NULL) { request->resp_bkt = (*request->acceptor)(request, conn->skt, request->acceptor_baton, request->respool); } status = (*request->handler)(request->resp_bkt, request->handler_baton, tmppool); if (!APR_STATUS_IS_EOF(status)) { /* Whether success, or an error, there is no more to do unless * this request has been completed. */ goto error; } /* The request has been fully-delivered, and the response has * been fully-read. Remove it from our queue and loop to read * another response. */ conn->requests = request->next; /* The bucket is no longer needed, nor is the request's pool. */ serf_bucket_destroy(request->resp_bkt); apr_pool_destroy(request->respool); request = conn->requests; /* If we just ran out of requests, then update the pollset. We * don't want to read from this socket any more. We are definitely * done with this loop, too. */ if (request == NULL) { status = update_pollset(conn); return status; } } error: apr_pool_destroy(tmppool); return status;} |
request->respool); | tmppool); apr_pool_clear(tmppool); | static apr_status_t read_from_connection(serf_connection_t *conn){ apr_status_t status; apr_pool_t *tmppool; /* Whatever is coming in on the socket corresponds to the first request * on our chain. */ serf_request_t *request = conn->requests; /* assert: request != NULL */ /* Invoke response handlers until we have no more work. */ while (1) { if ((status = apr_pool_create(&tmppool, request->respool)) != APR_SUCCESS) { return status; } /* If the request doesn't have a response bucket, then call the * acceptor to get one created. */ if (request->resp_bkt == NULL) { request->resp_bkt = (*request->acceptor)(request, conn->skt, request->acceptor_baton, request->respool); } status = (*request->handler)(request->resp_bkt, request->handler_baton, tmppool); if (!APR_STATUS_IS_EOF(status)) { /* Whether success, or an error, there is no more to do unless * this request has been completed. */ goto error; } /* The request has been fully-delivered, and the response has * been fully-read. Remove it from our queue and loop to read * another response. */ conn->requests = request->next; /* The bucket is no longer needed, nor is the request's pool. */ serf_bucket_destroy(request->resp_bkt); apr_pool_destroy(request->respool); request = conn->requests; /* If we just ran out of requests, then update the pollset. We * don't want to read from this socket any more. We are definitely * done with this loop, too. */ if (request == NULL) { status = update_pollset(conn); return status; } } error: apr_pool_destroy(tmppool); return status;} |
return status; | goto error; | static apr_status_t read_from_connection(serf_connection_t *conn){ apr_status_t status; apr_pool_t *tmppool; /* Whatever is coming in on the socket corresponds to the first request * on our chain. */ serf_request_t *request = conn->requests; /* assert: request != NULL */ /* Invoke response handlers until we have no more work. */ while (1) { if ((status = apr_pool_create(&tmppool, request->respool)) != APR_SUCCESS) { return status; } /* If the request doesn't have a response bucket, then call the * acceptor to get one created. */ if (request->resp_bkt == NULL) { request->resp_bkt = (*request->acceptor)(request, conn->skt, request->acceptor_baton, request->respool); } status = (*request->handler)(request->resp_bkt, request->handler_baton, tmppool); if (!APR_STATUS_IS_EOF(status)) { /* Whether success, or an error, there is no more to do unless * this request has been completed. */ goto error; } /* The request has been fully-delivered, and the response has * been fully-read. Remove it from our queue and loop to read * another response. */ conn->requests = request->next; /* The bucket is no longer needed, nor is the request's pool. */ serf_bucket_destroy(request->resp_bkt); apr_pool_destroy(request->respool); request = conn->requests; /* If we just ran out of requests, then update the pollset. We * don't want to read from this socket any more. We are definitely * done with this loop, too. */ if (request == NULL) { status = update_pollset(conn); return status; } } error: apr_pool_destroy(tmppool); return status;} |
tmp_dirent.d_ino = the_jnode->stat_ino; | tmp_dirent.d_ino = the_jnode->st_ino; | 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->stat_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;} |
if (typ(u) != t_POLMOD) u = to_polmod(u, (GEN)theta[1]); | rnfisnorm(GEN T, GEN x, long flag){ gpmem_t av = avma; GEN bnf = (GEN)T[1], rel = (GEN)T[2], relpol = (GEN)T[3], theta = (GEN)T[4]; GEN nf, aux, H, Y, M, A, suni, sunitrel, futu, tu, w; GEN prod, S1, S2; GEN res = cgetg(3,t_VEC); long L, i, drel, itu; if (typ(T) != t_VEC || lg(T) != 9) err(talker,"please apply rnfisnorminit first"); bnf = checkbnf(bnf); rel = checkbnf(rel); nf = checknf(bnf); x = basistoalg(nf,x); if (typ(x) != t_POLMOD) err(typeer, "rnfisnorm"); drel = degpol(relpol); if (gcmp0(x) || gcmp1(x) || (gcmp_1(x) && odd(drel))) { res[1] = (long)x; res[2] = un; return res; } /* build set T of ideals involved in the solutions */ prod = (GEN)T[5]; S1 = (GEN)T[6]; S2 = (GEN)T[7]; if (flag && !gcmp0((GEN)T[8])) err(warner,"useless flag in rnfisnorm: the extension is Galois"); if (flag > 0) { byteptr d = diffptr; long p = 0; if (maxprime() < flag) err(primer1); for(;;) { NEXT_PRIME_VIADIFF(p, d); if (p > flag) break; pr_append(nf,rel,stoi(p),&prod,&S1,&S2); } } else if (flag < 0) fa_pr_append(nf,rel,stoi(-flag),&prod,&S1,&S2); /* overkill: prime ideals dividing x would be enough */ fa_pr_append(nf,rel,idealnorm(nf,x), &prod,&S1,&S2); /* computation on T-units */ w = gmael3(rel,8,4,1); tu = gmael3(rel,8,4,2); futu = concatsp(check_units(rel,"rnfisnorm"), tu); suni = bnfsunit(bnf,S1,3); sunitrel = (GEN)bnfsunit(rel,S2,3)[1]; if (lg(sunitrel) > 1) sunitrel = lift_intern(basistoalg(rel,sunitrel)); sunitrel = concatsp(futu, sunitrel); A = lift(bnfissunit(bnf,suni,x)); L = lg(sunitrel); itu = lg(nf[6])-1; /* index of torsion unit in bnfsunit(nf) output */ M = cgetg(L+1,t_MAT); for (i=1; i<L; i++) { GEN u = poleval((GEN)sunitrel[i], theta); /* abstorel */ sunitrel[i] = (long)u; u = bnfissunit(bnf,suni, gnorm(u)); if (lg(u) == 1) err(bugparier,"rnfisnorm"); u[itu] = llift((GEN)u[itu]); /* lift root of 1 part */ M[i] = (long)u; } aux = zerocol(lg(A)-1); aux[itu] = (long)w; M[L] = (long)aux; 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]))) { 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(av, res);} |
|
Fq_gauss_get_col(GEN a, GEN b, GEN piv, long li, GEN T, GEN p) | Fq_gauss_get_col(GEN a, GEN b, GEN invpiv, long li, GEN T, GEN p) | Fq_gauss_get_col(GEN a, GEN b, GEN piv, long li, GEN T, GEN p){ GEN m, u=cgetg(li+1,t_COL); long i,j; u[li] = (long)FpXQ_mul((GEN)b[li], FpXQ_inv(piv,T,p), T,p); for (i=li-1; i>0; i--) { pari_sp av = avma; m = (GEN)b[i]; for (j=i+1; j<=li; j++) m = gsub(m, gmul(gcoeff(a,i,j), (GEN)u[j])); m = FpX_res(m, T,p); u[i] = lpileupto(av, FpXQ_mul(m, FpXQ_inv(gcoeff(a,i,i), T,p), T,p)); } return u;} |
u[li] = (long)FpXQ_mul((GEN)b[li], FpXQ_inv(piv,T,p), T,p); | u[li] = (long)FpXQ_mul((GEN)b[li], invpiv, T,p); | Fq_gauss_get_col(GEN a, GEN b, GEN piv, long li, GEN T, GEN p){ GEN m, u=cgetg(li+1,t_COL); long i,j; u[li] = (long)FpXQ_mul((GEN)b[li], FpXQ_inv(piv,T,p), T,p); for (i=li-1; i>0; i--) { pari_sp av = avma; m = (GEN)b[i]; for (j=i+1; j<=li; j++) m = gsub(m, gmul(gcoeff(a,i,j), (GEN)u[j])); m = FpX_res(m, T,p); u[i] = lpileupto(av, FpXQ_mul(m, FpXQ_inv(gcoeff(a,i,i), T,p), T,p)); } return u;} |
if (i==nb-1 && !isprime(gmael(fa,1,i))) p1 = powgi(gmael(fa,1,i),shifti(addis(e,1),-1)); | p1 = powgi(p,shifti(e,-1)); if ( i==nb-1 ) { if ( mod2(e) && !isprime(p) ) p1 = mulii(p1,p); } | indexpartial(GEN P){ ulong av = avma; long i, nb; GEN fa, p1, res = gun, dP,DP; dP = derivpol(P); if(DEBUGLEVEL>=5) gentimer(3); DP = ZX_disc(P); if(DEBUGLEVEL>=5) genmsgtimer(3,"IndexPartial: discriminant"); fa = auxdecomp(DP, 0); if(DEBUGLEVEL>=5) genmsgtimer(3,"IndexPartial: factorization"); nb = lg(fa[1]); for (i = 1; i < nb; i++) { GEN e=gmael(fa,2,i); if (DEBUGLEVEL>=5) gentimer(3); if (i==nb-1 && !isprime(gmael(fa,1,i))) p1 = powgi(gmael(fa,1,i),shifti(addis(e,1),-1)); else { p1 = powgi(gmael(fa,1,i),shifti(e,-1)); if (cmpis(e,2)>=0) p1=mppgcd(p1,respm(P,dP,p1)); } res=mulii(res,p1); if(DEBUGLEVEL>=5) genmsgtimer(3,"IndexPartial: factor %Z",p1); } return gerepileupto(av,res);} |
p1 = powgi(gmael(fa,1,i),shifti(e,-1)); if (cmpis(e,2)>=0) | if ( cmpis(e,2)>=0 ) | indexpartial(GEN P){ ulong av = avma; long i, nb; GEN fa, p1, res = gun, dP,DP; dP = derivpol(P); if(DEBUGLEVEL>=5) gentimer(3); DP = ZX_disc(P); if(DEBUGLEVEL>=5) genmsgtimer(3,"IndexPartial: discriminant"); fa = auxdecomp(DP, 0); if(DEBUGLEVEL>=5) genmsgtimer(3,"IndexPartial: factorization"); nb = lg(fa[1]); for (i = 1; i < nb; i++) { GEN e=gmael(fa,2,i); if (DEBUGLEVEL>=5) gentimer(3); if (i==nb-1 && !isprime(gmael(fa,1,i))) p1 = powgi(gmael(fa,1,i),shifti(addis(e,1),-1)); else { p1 = powgi(gmael(fa,1,i),shifti(e,-1)); if (cmpis(e,2)>=0) p1=mppgcd(p1,respm(P,dP,p1)); } res=mulii(res,p1); if(DEBUGLEVEL>=5) genmsgtimer(3,"IndexPartial: factor %Z",p1); } return gerepileupto(av,res);} |
if ( (temp == (((unsigned short) PCI_VENDOR_ID_VIA) | (PCI_DEVICE_ID_VIA_82C586_1 << 16))) || (temp == (((unsigned short) PCI_VENDOR_ID_VIA) | (PCI_DEVICE_ID_VIA_82C586_0 << 16))) | if ((temp == (((unsigned short) PCI_VENDOR_ID_VIA) | (PCI_DEVICE_ID_VIA_82C586_0 << 16))) | void VIA_isa_bridge_interrupts_setup(void){ pci_isa_bridge_device pci_dev; unsigned int temp; unsigned char tmp; unsigned char maxBus; unsigned found = 0; maxBus = BusCountPCI(); pci_dev.function = 0; /* Assumes the bidge is the first function */ for (pci_dev.bus = 0; pci_dev.bus < maxBus; pci_dev.bus++) {#ifdef SCAN_PCI_PRINT printk("isa_bridge_interrupts_setup: Scanning bus %d\n", pci_dev.bus);#endif for (pci_dev.device = 0; pci_dev.device < PCI_MAX_DEVICES; pci_dev.device++) {#ifdef SCAN_PCI_PRINT printk("isa_bridge_interrupts_setup: Scanning device %d\n", pci_dev.device);#endif pci_read_config_dword(pci_dev.bus, pci_dev.device, pci_dev.function, PCI_VENDOR_ID, &temp);#ifdef SCAN_PCI_PRINT printk("Vendor/device = %x\n", temp);#endif if ( (temp == (((unsigned short) PCI_VENDOR_ID_VIA) | (PCI_DEVICE_ID_VIA_82C586_1 << 16))) || (temp == (((unsigned short) PCI_VENDOR_ID_VIA) | (PCI_DEVICE_ID_VIA_82C586_0 << 16))) ) { bridge = pci_dev; via_82c586 = &bridge;#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS /* * Should print : bus = 0, device = 11, function = 0 on a MCP750. */ printk("Via PCI/ISA bridge found at bus = %d, device = %d, function = %d\n", via_82c586->bus, via_82c586->device, via_82c586->function);#endif found = 1; goto loop_exit; } } }loop_exit: if (!found) BSP_panic("VIA_82C586 PCI/ISA bridge not found!n"); tmp = inb(0x810); if ( !(tmp & 0x2)) {#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS printk("This is a second generation MCP750 board\n"); printk("We must reprogram the PCI/ISA bridge...\n");#endif pci_read_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, &tmp);#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS printk(" PCI ISA bridge control2 = %x\n", (unsigned) tmp);#endif /* * Enable 4D0/4D1 ISA interrupt level/edge config registers */ tmp |= 0x20; pci_write_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, tmp); /* * Now program the ISA interrupt edge/level */ tmp = ELCRS_INT9_LVL | ELCRS_INT10_LVL | ELCRS_INT11_LVL; outb(tmp, ISA8259_S_ELCR); tmp = ELCRM_INT5_LVL; outb(tmp, ISA8259_M_ELCR);; /* * Set the Interrupt inputs to non-inverting level interrupt */ pci_read_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x54, &tmp);#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS printk(" PCI ISA bridge PCI/IRQ Edge/Level Select = %x\n", (unsigned) tmp);#endif tmp = 0; pci_write_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x54, tmp); } else {#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS printk("This is a first generation MCP750 board\n"); printk("We just show the actual value used by PCI/ISA bridge\n");#endif pci_read_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, &tmp);#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS printk(" PCI ISA bridge control2 = %x\n", (unsigned) tmp);#endif /* * Enable 4D0/4D1 ISA interrupt level/edge config registers */ tmp |= 0x20; pci_write_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, tmp);#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS tmp = inb(ISA8259_S_ELCR); printk(" PCI ISA bridge slave edge/level control bit = %x\n", (unsigned) tmp); tmp = inb(ISA8259_M_ELCR);; printk(" PCI ISA bridge master edge/level control bit = %x\n", (unsigned) tmp);#endif /* * Must disable the 4D0/4D1 ISA interrupt level/edge config registers * or the card will die a soon as we we will enable external interrupts */ pci_read_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, &tmp); tmp &= ~(0x20); pci_write_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, tmp); /* * Show the Interrupt inputs inverting/non-inverting level status */ pci_read_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x54, &tmp);#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS printk(" PCI ISA bridge PCI/IRQ Edge/Level Select = %x\n", (unsigned) tmp);#endif }} |
* Enable 4D0/4D1 ISA interrupt level/edge config registers */ tmp |= 0x20; pci_write_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, tmp); #ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS tmp = inb(ISA8259_S_ELCR); printk(" PCI ISA bridge slave edge/level control bit = %x\n", (unsigned) tmp); tmp = inb(ISA8259_M_ELCR);; printk(" PCI ISA bridge master edge/level control bit = %x\n", (unsigned) tmp); #endif pci_read_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, &tmp); tmp &= ~(0x20); pci_write_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, tmp); | void VIA_isa_bridge_interrupts_setup(void){ pci_isa_bridge_device pci_dev; unsigned int temp; unsigned char tmp; unsigned char maxBus; unsigned found = 0; maxBus = BusCountPCI(); pci_dev.function = 0; /* Assumes the bidge is the first function */ for (pci_dev.bus = 0; pci_dev.bus < maxBus; pci_dev.bus++) {#ifdef SCAN_PCI_PRINT printk("isa_bridge_interrupts_setup: Scanning bus %d\n", pci_dev.bus);#endif for (pci_dev.device = 0; pci_dev.device < PCI_MAX_DEVICES; pci_dev.device++) {#ifdef SCAN_PCI_PRINT printk("isa_bridge_interrupts_setup: Scanning device %d\n", pci_dev.device);#endif pci_read_config_dword(pci_dev.bus, pci_dev.device, pci_dev.function, PCI_VENDOR_ID, &temp);#ifdef SCAN_PCI_PRINT printk("Vendor/device = %x\n", temp);#endif if ( (temp == (((unsigned short) PCI_VENDOR_ID_VIA) | (PCI_DEVICE_ID_VIA_82C586_1 << 16))) || (temp == (((unsigned short) PCI_VENDOR_ID_VIA) | (PCI_DEVICE_ID_VIA_82C586_0 << 16))) ) { bridge = pci_dev; via_82c586 = &bridge;#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS /* * Should print : bus = 0, device = 11, function = 0 on a MCP750. */ printk("Via PCI/ISA bridge found at bus = %d, device = %d, function = %d\n", via_82c586->bus, via_82c586->device, via_82c586->function);#endif found = 1; goto loop_exit; } } }loop_exit: if (!found) BSP_panic("VIA_82C586 PCI/ISA bridge not found!n"); tmp = inb(0x810); if ( !(tmp & 0x2)) {#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS printk("This is a second generation MCP750 board\n"); printk("We must reprogram the PCI/ISA bridge...\n");#endif pci_read_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, &tmp);#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS printk(" PCI ISA bridge control2 = %x\n", (unsigned) tmp);#endif /* * Enable 4D0/4D1 ISA interrupt level/edge config registers */ tmp |= 0x20; pci_write_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, tmp); /* * Now program the ISA interrupt edge/level */ tmp = ELCRS_INT9_LVL | ELCRS_INT10_LVL | ELCRS_INT11_LVL; outb(tmp, ISA8259_S_ELCR); tmp = ELCRM_INT5_LVL; outb(tmp, ISA8259_M_ELCR);; /* * Set the Interrupt inputs to non-inverting level interrupt */ pci_read_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x54, &tmp);#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS printk(" PCI ISA bridge PCI/IRQ Edge/Level Select = %x\n", (unsigned) tmp);#endif tmp = 0; pci_write_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x54, tmp); } else {#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS printk("This is a first generation MCP750 board\n"); printk("We just show the actual value used by PCI/ISA bridge\n");#endif pci_read_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, &tmp);#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS printk(" PCI ISA bridge control2 = %x\n", (unsigned) tmp);#endif /* * Enable 4D0/4D1 ISA interrupt level/edge config registers */ tmp |= 0x20; pci_write_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, tmp);#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS tmp = inb(ISA8259_S_ELCR); printk(" PCI ISA bridge slave edge/level control bit = %x\n", (unsigned) tmp); tmp = inb(ISA8259_M_ELCR);; printk(" PCI ISA bridge master edge/level control bit = %x\n", (unsigned) tmp);#endif /* * Must disable the 4D0/4D1 ISA interrupt level/edge config registers * or the card will die a soon as we we will enable external interrupts */ pci_read_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, &tmp); tmp &= ~(0x20); pci_write_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x47, tmp); /* * Show the Interrupt inputs inverting/non-inverting level status */ pci_read_config_byte(via_82c586->bus, via_82c586->device, via_82c586->function, 0x54, &tmp);#ifdef SHOW_ISA_PCI_BRIDGE_SETTINGS printk(" PCI ISA bridge PCI/IRQ Edge/Level Select = %x\n", (unsigned) tmp);#endif }} |
|
(void)sprintf(s, SIZE, "not compiled in"); | (void)sprintf(s, "not compiled in"); | what_readline(char **buf){ char *s;#ifdef READLINE char *ver, *extra = stackmalloc(strlen(READLINE) + 32);# if defined(HAS_RL_LIBRARY_VERSION) || defined(FAKE_RL_LIBRARY_VERSION)# ifdef FAKE_RL_LIBRARY_VERSION extern char *rl_library_version;# endif if (strcmp(READLINE, rl_library_version)) { ver = (char*)rl_library_version; (void)sprintf(extra, " [was v%s in Configure]", READLINE); } else# endif { ver = READLINE; extra[0] = 0; } s = stackmalloc(3 + strlen(ver) + 8 + strlen(extra)); (void)sprintf(s, "v%s %s%s", ver, (GP_DATA->flags & USE_READLINE)? "enabled": "disabled", extra);#else s = stackmalloc(32); (void)sprintf(s, SIZE, "not compiled in");#endif *buf = s;} |
if (l1>LGBITS) l1=LGBITS; | if ((ulong)l1>LGBITS) l1=LGBITS; | sfcont(GEN x, GEN x1, long k){ long av,lx=lg(x),tx=typ(x),e,i,j,l,l1,lx1,tetpil,f; GEN y,p1,p2,p3,p4,yp; if (is_scalar_t(tx)) { if (gcmp0(x)) { y=cgetg(2,t_VEC); y[1]=zero; return y; } switch(tx) { case t_INT: y=cgetg(2,t_VEC); y[1]=lcopy(x); return y; case t_REAL: l=avma; p1=cgetg(3,t_FRACN); p2 = rcopy(x); settyp(p2,t_INT); setlgefint(p2,lx); p1[1] = (long) p2; e = bit_accuracy(lx)-1-expo(x); if (e<0) err(talker,"integral part not significant in scfont"); l1 = (e>>TWOPOTBITS_IN_LONG)+3; p2=cgeti(l1); p2[1]= evalsigne(1)|evallgefint(l1); p2[2]= (1L<<(e&(BITS_IN_LONG-1))); for (i=3; i<l1; i++) p2[i]=0; p1[2]=(long) p2; p3=cgetg(3,t_FRACN); p3[2]=lcopy(p2); p3[1]=laddsi(signe(x),(GEN)p1[1]); p1=sfcont(p1,p1,k); tetpil=avma; return gerepile(l,tetpil,sfcont(p3,p1,k)); case t_FRAC: case t_FRACN: l=avma; lx1=lgefint(x[2]); l1 = (long) ((double) BYTES_IN_LONG/4.0*46.093443*(lx1-2)+3); if (k>0 && ++k > 0 && l1 > k) l1 = k; /* beware overflow */ if (l1>LGBITS) l1=LGBITS; if (lgefint(x[1]) >= lx1) p1=icopy((GEN)x[1]); else affii((GEN)x[1],p1=cgeti(lx1)); p2=icopy((GEN)x[2]); lx1=lg(x1); y=cgetg(l1,t_VEC); f=(x!=x1); i=0; while (!gcmp0(p2) && i<=l1-2) { i++; y[i]=ldvmdii(p1,p2,&p3); if (signe(p3)>=0) affii(p3,p1); else { p4=addii(p3,p2); affii(p4,p1); cgiv(p4); y[1]=laddsi(-1,(GEN)y[1]); } cgiv(p3); p4=p1; p1=p2; p2=p4; if (f) { if (i>=lx1) { i--; break; } if (!egalii((GEN)y[i],(GEN)x1[i])) { av=avma; if (gcmp1(absi(subii((GEN)x1[i],(GEN)y[i])))) { if (i>=lx1-1 || !gcmp1((GEN)x1[i+1])) affii((GEN)x1[i],(GEN)y[i]); } else i--; avma=av; break; } } } if (i>=2 && gcmp1((GEN)y[i])) { cgiv((GEN)y[i]); --i; cgiv((GEN)y[i]); y[i]=laddsi(1,(GEN)y[i]); } setlg(y,i+1); return gerepileupto(l, y); } err(typeer,"sfcont"); } switch(tx) { case t_POL: y=cgetg(2,t_VEC); y[1]=lcopy(x); break; case t_SER: av=avma; p1=gtrunc(x); tetpil=avma; y=gerepile(av,tetpil,sfcont(p1,p1,k)); break; case t_RFRAC: case t_RFRACN: av=avma; l1=lgef(x[1]); if (lgef(x[2])>l1) l1=lgef(x[2]); if (k>0 && l1>k+1) l1=k+1; yp=cgetg(l1,t_VEC); p1=(GEN)x[1]; i=0; p2=(GEN)x[2]; while (!gcmp0(p2) && i<=l1-2) { i++; yp[i]=ldivres(p1,p2,&p3); p1=p2; p2=p3; } tetpil=avma; y=cgetg(i+1,t_VEC); for (j=1; j<=i; j++) y[j]=lcopy((GEN)yp[j]); y=gerepile(av,tetpil,y); break; default: err(typeer,"sfcont"); return NULL; /* not reached */ } return y;} |
powsubFBgen(GEN nf,GEN subFB,long a,long prec,long precint) | powsubFBgen(GEN nf,GEN subFB,long a,long prec) | powsubFBgen(GEN nf,GEN subFB,long a,long prec,long precint){ long i,j, n = lg(subFB); GEN *pow, arch0 = (GEN)init_idele(nf)[2]; if (DEBUGLEVEL) fprintferr("Computing powers for sub-factor base:\n"); powsubFB = cgetg(n, t_VEC); for (i=1; i<n; i++) { GEN vp = (GEN)vectbase[subFB[i]]; GEN z = cgetg(3,t_VEC); z[1]=vp[1]; z[2]=vp[2]; pow = (GEN*)cgetg(a+1,t_VEC); powsubFB[i] = (long)pow; pow[1]=cgetg(3,t_VEC); pow[1][1] = (long)z; pow[1][2] = (long)arch0; vp = prime_to_ideal(nf,vp); for (j=2; j<=a; j++) { pow[j] = mulred(nf,pow[j-1],vp,prec,precint); if (DEBUGLEVEL>1) fprintferr(" %ld",j); } if (DEBUGLEVEL>1) { fprintferr("\n"); flusherr(); } } if (DEBUGLEVEL) { if (DEBUGLEVEL>7) { fprintferr("**** POWERS IN SUB-FACTOR BASE ****\n\n"); for (i=1; i<n; i++) { fprintferr("powsubFB[%ld]:\n",i); for (j=1; j<=a; j++) fprintferr("^%ld = %Z\n", j,mael(powsubFB,i,j)); fprintferr("\n"); } } msgtimer("powsubFBgen"); }} |
pow[j] = mulred(nf,pow[j-1],vp,prec,precint); | pow[j] = mulred(nf,pow[j-1],vp,prec); | powsubFBgen(GEN nf,GEN subFB,long a,long prec,long precint){ long i,j, n = lg(subFB); GEN *pow, arch0 = (GEN)init_idele(nf)[2]; if (DEBUGLEVEL) fprintferr("Computing powers for sub-factor base:\n"); powsubFB = cgetg(n, t_VEC); for (i=1; i<n; i++) { GEN vp = (GEN)vectbase[subFB[i]]; GEN z = cgetg(3,t_VEC); z[1]=vp[1]; z[2]=vp[2]; pow = (GEN*)cgetg(a+1,t_VEC); powsubFB[i] = (long)pow; pow[1]=cgetg(3,t_VEC); pow[1][1] = (long)z; pow[1][2] = (long)arch0; vp = prime_to_ideal(nf,vp); for (j=2; j<=a; j++) { pow[j] = mulred(nf,pow[j-1],vp,prec,precint); if (DEBUGLEVEL>1) fprintferr(" %ld",j); } if (DEBUGLEVEL>1) { fprintferr("\n"); flusherr(); } } if (DEBUGLEVEL) { if (DEBUGLEVEL>7) { fprintferr("**** POWERS IN SUB-FACTOR BASE ****\n\n"); for (i=1; i<n; i++) { fprintferr("powsubFB[%ld]:\n",i); for (j=1; j<=a; j++) fprintferr("^%ld = %Z\n", j,mael(powsubFB,i,j)); fprintferr("\n"); } } msgtimer("powsubFBgen"); }} |
GEN p1, P = (GEN)x[1], b = (GEN)P[3], c = (GEN)P[2]; | GEN z, P, b, c, u = (GEN)x[2], v = (GEN)x[3]; | qtop(GEN x, GEN p, long d){ GEN p1, P = (GEN)x[1], b = (GEN)P[3], c = (GEN)P[2]; pari_sp av; if (gcmp0(x)) return zeropadic(p, d); av = avma; p1 = gsqrt(cvtop(subii(b, shifti(c,2)), p, egalii(p,gdeux)? d+2: d), 0); p1 = gmul2n(gsub(p1, b), -1); return gerepileupto(av, gadd((GEN)x[2], gmul((GEN)x[3], p1)));} |
if (gcmp0(x)) return zeropadic(p, d); av = avma; p1 = gsqrt(cvtop(subii(b, shifti(c,2)), p, egalii(p,gdeux)? d+2: d), 0); p1 = gmul2n(gsub(p1, b), -1); return gerepileupto(av, gadd((GEN)x[2], gmul((GEN)x[3], p1))); | if (gcmp0(v)) return cvtop(u, p, d); P = (GEN)x[1]; b = (GEN)P[3]; c = (GEN)P[2]; av = avma; z = gsqrt(cvtop(subii(b, shifti(c,2)), p, egalii(p,gdeux)? d+2: d), 0); z = gmul2n(gsub(z, b), -1); return gerepileupto(av, gadd(u, gmul(v, z))); | qtop(GEN x, GEN p, long d){ GEN p1, P = (GEN)x[1], b = (GEN)P[3], c = (GEN)P[2]; pari_sp av; if (gcmp0(x)) return zeropadic(p, d); av = avma; p1 = gsqrt(cvtop(subii(b, shifti(c,2)), p, egalii(p,gdeux)? d+2: d), 0); p1 = gmul2n(gsub(p1, b), -1); return gerepileupto(av, gadd((GEN)x[2], gmul((GEN)x[3], p1)));} |
sigemptyset( &old_mask ); | unsigned32 _CPU_ISR_Disable_support(void){ int status; sigset_t old_mask; status = sigprocmask(SIG_BLOCK, &_CPU_Signal_mask, &old_mask); if ( status ) _Internal_error_Occurred( INTERNAL_ERROR_CORE, TRUE, status ); if (memcmp((void *)&posix_empty_mask, (void *)&old_mask, sizeof(sigset_t))) return 1; return 0;} |
|
settyp(C, t_VEC); return gerepileupto(av, gcopy(C)); | settyp(C, t_VEC); return gerepilecopy(av, C); | polcompositum0(GEN A, GEN B, long flall){ ulong av = avma; long v,k; GEN C, LPRS; if (typ(A)!=t_POL || typ(B)!=t_POL) err(typeer,"polcompositum0"); if (degpol(A)<=0 || degpol(B)<=0) err(constpoler,"compositum"); v = varn(A); if (varn(B) != v) err(talker,"not the same variable in compositum"); C = content(A); if (!gcmp1(C)) A = gdiv(A, C); C = content(B); if (!gcmp1(C)) B = gdiv(B, C); check_pol_int(A,"compositum"); check_pol_int(B,"compositum"); if (!ZX_is_squarefree(A)) err(talker,"compositum: %Z not separable", A); if (!ZX_is_squarefree(B)) err(talker,"compositum: %Z not separable", B); k = 1; C = ZY_ZXY_resultant_all(A, B, &k, flall? &LPRS: NULL); C = squff2(C,0,0); /* C = Res_Y (A, B(X + kY)) guaranteed squarefree */ if (flall) { long i,l = lg(C); GEN w,a,b; /* a,b,c root of A,B,C = compositum, c = b - k a */ for (i=1; i<l; i++) { /* invmod possibly very costly */ a = gmul((GEN)LPRS[1], ZX_invmod((GEN)LPRS[2], (GEN)C[i])); a = gneg_i(gmod(a, (GEN)C[i])); b = gadd(polx[v], gmulsg(k,a)); w = cgetg(5,t_VEC); /* [C, a, b, n ] */ w[1] = C[i]; w[2] = (long)to_polmod(a, (GEN)w[1]); w[3] = (long)to_polmod(b, (GEN)w[1]); w[4] = lstoi(-k); C[i] = (long)w; } } settyp(C, t_VEC); return gerepileupto(av, gcopy(C));} |
killv = (avma != (long)pol); | killv = (avma != (ulong)pol); | factor(GEN x){ long tx=typ(x),lx,av,tetpil,i,j,pa,v,r1; GEN y,p,p1,p2,p3,p4,p5,pol; if (is_matvec_t(tx)) { lx=lg(x); y=cgetg(lx,tx); for (i=1; i<lx; i++) y[i]=(long)factor((GEN)x[i]); return y; } if (gcmp0(x)) { y=cgetg(3,t_MAT); p1=cgetg(2,t_COL); y[1]=(long)p1; p1[1]=lcopy(x); p2=cgetg(2,t_COL); y[2]=(long)p2; p2[1]=un; return y; } av = avma; switch(tx) { case t_INT: return decomp(x); case t_FRACN: x = gred(x); /* fall through */ case t_FRAC: p1 = decomp((GEN)x[1]); p2 = decomp((GEN)x[2]); p2[2] = (long)gneg_i((GEN)p2[2]); return gerepileupto(av, gcopy(merge_factor_i(p1,p2))); case t_POL: tx=poltype(x,&p,&pol,&pa); switch(tx) { case 0: err(impl,"factor for general polynomials"); case t_INT: return factpol(x,0,1); case t_INTMOD: return factmod(x,p); case t_COMPLEX: y=cgetg(3,t_MAT); lx=lgef(x)-2; v=varn(x); p1=roots(x,pa); tetpil=avma; p2=cgetg(lx,t_COL); for (i=1; i<lx; i++) p2[i] = (long)deg1pol_i(gun, gneg((GEN)p1[i]), v); y[1]=lpile(av,tetpil,p2); p3=cgetg(lx,t_COL); for (i=1; i<lx; i++) p3[i] = un; y[2]=(long)p3; return y; case t_REAL: y=cgetg(3,t_MAT); lx=lgef(x)-2; v=varn(x); av=avma; p1=roots(x,pa); tetpil=avma; for(r1=1; r1<lx; r1++) if (signe(gmael(p1,r1,2))) break; lx=(r1+lx)>>1; p2=cgetg(lx,t_COL); for(i=1; i<r1; i++) p2[i] = (long)deg1pol_i(gun, negr(gmael(p1,i,1)), v); for( ; i<lx; i++) { GEN a = (GEN) p1[2*i-r1]; p = cgetg(5, t_POL); p2[i] = (long)p; p[1] = evalsigne(1) | evalvarn(v) | evallgef(5); p[2] = lnorm(a); p[3] = lmul2n((GEN)a[1],1); setsigne(p[3],-signe(p[3])); p[4] = un; } y[1]=lpile(av,tetpil,p2); p3=cgetg(lx,t_COL); for (i=1; i<lx; i++) p3[i] = un; y[2]=(long)p3; return y; case t_PADIC: return factorpadic4(x,p,pa); default: { long killv; x = dummycopy(x); lx=lgef(x); pol = dummycopy(pol); v = manage_var(4,NULL); for(i=2; i<lx; i++) { p1=(GEN)x[i]; switch(typ(p1)) { case t_QUAD: p1++; case t_COMPLEX: p2 = cgetg(3, t_POLMOD); x[i] = (long) p2; p2[1] = (long)pol; p2[2] = (long)deg1pol_i((GEN)p1[2], (GEN)p1[1], v); } } killv = (avma != (long)pol); if (killv) setvarn(pol, fetch_var()); switch (typ2(tx)) { case t_INT: p1 = polfnf(x,pol); break; case t_INTMOD: p1 = factmod9(x,p,pol); break; default: err(impl,"factor of general polynomial"); return NULL; /* not reached */ } switch (typ1(tx)) { case t_POLMOD: if (killv) delete_var(); return gerepileupto(av,p1); case t_COMPLEX: p5 = gi; break; case t_QUAD: p5=cgetg(4,t_QUAD); p5[1]=(long)pol; p5[2]=zero; p5[3]=un; break; default: err(impl,"factor of general polynomial"); return NULL; /* not reached */ } p2=(GEN)p1[1]; for(i=1; i<lg(p2); i++) { p3=(GEN)p2[i]; for(j=2; j<lgef(p3); j++) { p4=(GEN)p3[j]; if(typ(p4)==t_POLMOD) p3[j]=lsubst((GEN)p4[2],v,p5); } } if (killv) delete_var(); tetpil=avma; y=cgetg(3,t_MAT); y[1]=lcopy(p2);y[2]=lcopy((GEN)p1[2]); return gerepile(av,tetpil,y); } } case t_RFRACN: x=gred_rfrac(x); /* fall through */ case t_RFRAC: p1=factor((GEN)x[1]); p2=factor((GEN)x[2]); p3=gneg_i((GEN)p2[2]); tetpil=avma; y=cgetg(3,t_MAT); y[1]=lconcat((GEN)p1[1],(GEN)p2[1]); y[2]=lconcat((GEN)p1[2],p3); return gerepile(av,tetpil,y); } err(talker,"can't factor %Z",x); return NULL; /* not reached */} |
float minx, miny, maxx, maxy; IPoint *ip; | IPoint vx, vy, tv; float xx,xy,yx,yy, det; | void svg_render_solid(SDL_svg_context *c){int i,j;int colorstops;//void (*renderfunc)(SDL_svg_context *c, int x, int y, int w);float minx, miny, maxx, maxy;IPoint *ip;IPoint *path;svg_paint_t *paint;const svg_color_t *rgb;int alpha; c->renderfunc = 0; path = c->path; minx=miny = 0x7fffffff; maxx=maxy =-0x7fffffff; for(i=0, ip=path;i<c->numpoints;++i,++ip) { if(ip->x<minx) minx=ip->x; if(ip->x>maxx) maxx=ip->x; if(ip->y<miny) miny=ip->y; if(ip->y>maxy) maxy=ip->y; } paint = c->paint; switch(paint->type) { case SVG_PAINT_TYPE_COLOR: rgb = &paint->p.color; alpha = 255.0 * c->FillOpacity; c->solidcolor = maprgb(c->surface, svg_color_get_red(rgb), svg_color_get_green(rgb), svg_color_get_blue(rgb)) | (alpha << 24); c->renderfunc = solidstrip; break; case SVG_PAINT_TYPE_GRADIENT: colorstops = paint->p.gradient->num_stops; for(i=0;i<colorstops-1;++i) { int c1,c2; int r1,g1,b1,a1,r2,g2,b2,a2; unsigned long t; int v; c1=NUM_GRADIENT_COLORS*i/(colorstops-1); c2=NUM_GRADIENT_COLORS*(i+1)/(colorstops-1); t=paint->p.gradient->stops[i].color.rgb; a1=255.0 * paint->p.gradient->stops[i].opacity; r1 = (t>>16) & 255; g1 = (t>>8) & 255; b1 = t & 255; t=paint->p.gradient->stops[i+1].color.rgb; a2=255.0 * paint->p.gradient->stops[i+1].opacity; r2 = (t>>16) & 255; g2 = (t>>8) & 255; b2 = t & 255; r2-=r1; g2-=g1; b2-=b1; a2-=a1; v=c2-c1-1; for(j=0;j<=v;++j) { c->gradient_colors[c1+j]=maprgb(c->surface, r1 + r2*j/v, g1 + g2*j/v, b1 + b2*j/v) | ((a1 + a2*j/v)<<24); } } c->gradient_policy = paint->p.gradient->spread; if (paint->p.gradient->type == SVG_GRADIENT_LINEAR) { c->renderfunc = lineargradient; c->gradient_p1 = (IPoint) { paint->p.gradient->u.linear.x1.value, paint->p.gradient->u.linear.y1.value}; c->gradient_p2 = (IPoint) { paint->p.gradient->u.linear.x2.value, paint->p.gradient->u.linear.y2.value}; } else if(paint->p.gradient->type == SVG_GRADIENT_RADIAL) { c->renderfunc = radialgradient; c->gradient_p1 = (IPoint) { paint->p.gradient->u.radial.cx.value, paint->p.gradient->u.radial.cy.value}; c->gradient_p2 = (IPoint) { paint->p.gradient->u.radial.fx.value, paint->p.gradient->u.radial.fy.value}; c->gradient_r = paint->p.gradient->u.radial.r.value; } else c->renderfunc = 0; if(paint->p.gradient->units==SVG_GRADIENT_UNITS_USER) { c->gradient_p1 = FixCoords(c, c->gradient_p1); c->gradient_p2 = FixCoords(c, c->gradient_p2); c->gradient_r = FixSizes(c, (IPoint) {c->gradient_r, 0.0}).x; } else // BBOX { c->gradient_p1 = (IPoint) {minx + c->gradient_p1.x * (maxx - minx + 1), miny + c->gradient_p1.y * (maxy - miny + 1)}; c->gradient_p2 = (IPoint) {minx + c->gradient_p2.x * (maxx - minx + 1), miny + c->gradient_p2.y * (maxy - miny + 1)}; c->gradient_r = c->gradient_r * (maxx - minx + 1); } break; default: c->renderfunc = 0; break; } do_render(c);} |
minx=miny = 0x7fffffff; maxx=maxy =-0x7fffffff; | tv = FixCoords(c, (IPoint) {c->minx, c->miny}); vx = FixCoords(c, (IPoint) {c->maxx, c->miny}); vy = FixCoords(c, (IPoint) {c->minx, c->maxy}); | void svg_render_solid(SDL_svg_context *c){int i,j;int colorstops;//void (*renderfunc)(SDL_svg_context *c, int x, int y, int w);float minx, miny, maxx, maxy;IPoint *ip;IPoint *path;svg_paint_t *paint;const svg_color_t *rgb;int alpha; c->renderfunc = 0; path = c->path; minx=miny = 0x7fffffff; maxx=maxy =-0x7fffffff; for(i=0, ip=path;i<c->numpoints;++i,++ip) { if(ip->x<minx) minx=ip->x; if(ip->x>maxx) maxx=ip->x; if(ip->y<miny) miny=ip->y; if(ip->y>maxy) maxy=ip->y; } paint = c->paint; switch(paint->type) { case SVG_PAINT_TYPE_COLOR: rgb = &paint->p.color; alpha = 255.0 * c->FillOpacity; c->solidcolor = maprgb(c->surface, svg_color_get_red(rgb), svg_color_get_green(rgb), svg_color_get_blue(rgb)) | (alpha << 24); c->renderfunc = solidstrip; break; case SVG_PAINT_TYPE_GRADIENT: colorstops = paint->p.gradient->num_stops; for(i=0;i<colorstops-1;++i) { int c1,c2; int r1,g1,b1,a1,r2,g2,b2,a2; unsigned long t; int v; c1=NUM_GRADIENT_COLORS*i/(colorstops-1); c2=NUM_GRADIENT_COLORS*(i+1)/(colorstops-1); t=paint->p.gradient->stops[i].color.rgb; a1=255.0 * paint->p.gradient->stops[i].opacity; r1 = (t>>16) & 255; g1 = (t>>8) & 255; b1 = t & 255; t=paint->p.gradient->stops[i+1].color.rgb; a2=255.0 * paint->p.gradient->stops[i+1].opacity; r2 = (t>>16) & 255; g2 = (t>>8) & 255; b2 = t & 255; r2-=r1; g2-=g1; b2-=b1; a2-=a1; v=c2-c1-1; for(j=0;j<=v;++j) { c->gradient_colors[c1+j]=maprgb(c->surface, r1 + r2*j/v, g1 + g2*j/v, b1 + b2*j/v) | ((a1 + a2*j/v)<<24); } } c->gradient_policy = paint->p.gradient->spread; if (paint->p.gradient->type == SVG_GRADIENT_LINEAR) { c->renderfunc = lineargradient; c->gradient_p1 = (IPoint) { paint->p.gradient->u.linear.x1.value, paint->p.gradient->u.linear.y1.value}; c->gradient_p2 = (IPoint) { paint->p.gradient->u.linear.x2.value, paint->p.gradient->u.linear.y2.value}; } else if(paint->p.gradient->type == SVG_GRADIENT_RADIAL) { c->renderfunc = radialgradient; c->gradient_p1 = (IPoint) { paint->p.gradient->u.radial.cx.value, paint->p.gradient->u.radial.cy.value}; c->gradient_p2 = (IPoint) { paint->p.gradient->u.radial.fx.value, paint->p.gradient->u.radial.fy.value}; c->gradient_r = paint->p.gradient->u.radial.r.value; } else c->renderfunc = 0; if(paint->p.gradient->units==SVG_GRADIENT_UNITS_USER) { c->gradient_p1 = FixCoords(c, c->gradient_p1); c->gradient_p2 = FixCoords(c, c->gradient_p2); c->gradient_r = FixSizes(c, (IPoint) {c->gradient_r, 0.0}).x; } else // BBOX { c->gradient_p1 = (IPoint) {minx + c->gradient_p1.x * (maxx - minx + 1), miny + c->gradient_p1.y * (maxy - miny + 1)}; c->gradient_p2 = (IPoint) {minx + c->gradient_p2.x * (maxx - minx + 1), miny + c->gradient_p2.y * (maxy - miny + 1)}; c->gradient_r = c->gradient_r * (maxx - minx + 1); } break; default: c->renderfunc = 0; break; } do_render(c);} |
for(i=0, ip=path;i<c->numpoints;++i,++ip) | c->e = -tv.x; c->f = -tv.y; xx = vx.x - tv.x; xy = vx.y - tv.y; yx = vy.x - tv.x; yy = vy.y - tv.y; det = xx*yy - xy*yx; if(det != 0.0) | void svg_render_solid(SDL_svg_context *c){int i,j;int colorstops;//void (*renderfunc)(SDL_svg_context *c, int x, int y, int w);float minx, miny, maxx, maxy;IPoint *ip;IPoint *path;svg_paint_t *paint;const svg_color_t *rgb;int alpha; c->renderfunc = 0; path = c->path; minx=miny = 0x7fffffff; maxx=maxy =-0x7fffffff; for(i=0, ip=path;i<c->numpoints;++i,++ip) { if(ip->x<minx) minx=ip->x; if(ip->x>maxx) maxx=ip->x; if(ip->y<miny) miny=ip->y; if(ip->y>maxy) maxy=ip->y; } paint = c->paint; switch(paint->type) { case SVG_PAINT_TYPE_COLOR: rgb = &paint->p.color; alpha = 255.0 * c->FillOpacity; c->solidcolor = maprgb(c->surface, svg_color_get_red(rgb), svg_color_get_green(rgb), svg_color_get_blue(rgb)) | (alpha << 24); c->renderfunc = solidstrip; break; case SVG_PAINT_TYPE_GRADIENT: colorstops = paint->p.gradient->num_stops; for(i=0;i<colorstops-1;++i) { int c1,c2; int r1,g1,b1,a1,r2,g2,b2,a2; unsigned long t; int v; c1=NUM_GRADIENT_COLORS*i/(colorstops-1); c2=NUM_GRADIENT_COLORS*(i+1)/(colorstops-1); t=paint->p.gradient->stops[i].color.rgb; a1=255.0 * paint->p.gradient->stops[i].opacity; r1 = (t>>16) & 255; g1 = (t>>8) & 255; b1 = t & 255; t=paint->p.gradient->stops[i+1].color.rgb; a2=255.0 * paint->p.gradient->stops[i+1].opacity; r2 = (t>>16) & 255; g2 = (t>>8) & 255; b2 = t & 255; r2-=r1; g2-=g1; b2-=b1; a2-=a1; v=c2-c1-1; for(j=0;j<=v;++j) { c->gradient_colors[c1+j]=maprgb(c->surface, r1 + r2*j/v, g1 + g2*j/v, b1 + b2*j/v) | ((a1 + a2*j/v)<<24); } } c->gradient_policy = paint->p.gradient->spread; if (paint->p.gradient->type == SVG_GRADIENT_LINEAR) { c->renderfunc = lineargradient; c->gradient_p1 = (IPoint) { paint->p.gradient->u.linear.x1.value, paint->p.gradient->u.linear.y1.value}; c->gradient_p2 = (IPoint) { paint->p.gradient->u.linear.x2.value, paint->p.gradient->u.linear.y2.value}; } else if(paint->p.gradient->type == SVG_GRADIENT_RADIAL) { c->renderfunc = radialgradient; c->gradient_p1 = (IPoint) { paint->p.gradient->u.radial.cx.value, paint->p.gradient->u.radial.cy.value}; c->gradient_p2 = (IPoint) { paint->p.gradient->u.radial.fx.value, paint->p.gradient->u.radial.fy.value}; c->gradient_r = paint->p.gradient->u.radial.r.value; } else c->renderfunc = 0; if(paint->p.gradient->units==SVG_GRADIENT_UNITS_USER) { c->gradient_p1 = FixCoords(c, c->gradient_p1); c->gradient_p2 = FixCoords(c, c->gradient_p2); c->gradient_r = FixSizes(c, (IPoint) {c->gradient_r, 0.0}).x; } else // BBOX { c->gradient_p1 = (IPoint) {minx + c->gradient_p1.x * (maxx - minx + 1), miny + c->gradient_p1.y * (maxy - miny + 1)}; c->gradient_p2 = (IPoint) {minx + c->gradient_p2.x * (maxx - minx + 1), miny + c->gradient_p2.y * (maxy - miny + 1)}; c->gradient_r = c->gradient_r * (maxx - minx + 1); } break; default: c->renderfunc = 0; break; } do_render(c);} |
if(ip->x<minx) minx=ip->x; if(ip->x>maxx) maxx=ip->x; if(ip->y<miny) miny=ip->y; if(ip->y>maxy) maxy=ip->y; } | c->a = yy / det; c->b = -yx / det; c->c = -xy / det; c->d = xx / det; } else c->a = c->b = c->c = c->d = 0.0; | void svg_render_solid(SDL_svg_context *c){int i,j;int colorstops;//void (*renderfunc)(SDL_svg_context *c, int x, int y, int w);float minx, miny, maxx, maxy;IPoint *ip;IPoint *path;svg_paint_t *paint;const svg_color_t *rgb;int alpha; c->renderfunc = 0; path = c->path; minx=miny = 0x7fffffff; maxx=maxy =-0x7fffffff; for(i=0, ip=path;i<c->numpoints;++i,++ip) { if(ip->x<minx) minx=ip->x; if(ip->x>maxx) maxx=ip->x; if(ip->y<miny) miny=ip->y; if(ip->y>maxy) maxy=ip->y; } paint = c->paint; switch(paint->type) { case SVG_PAINT_TYPE_COLOR: rgb = &paint->p.color; alpha = 255.0 * c->FillOpacity; c->solidcolor = maprgb(c->surface, svg_color_get_red(rgb), svg_color_get_green(rgb), svg_color_get_blue(rgb)) | (alpha << 24); c->renderfunc = solidstrip; break; case SVG_PAINT_TYPE_GRADIENT: colorstops = paint->p.gradient->num_stops; for(i=0;i<colorstops-1;++i) { int c1,c2; int r1,g1,b1,a1,r2,g2,b2,a2; unsigned long t; int v; c1=NUM_GRADIENT_COLORS*i/(colorstops-1); c2=NUM_GRADIENT_COLORS*(i+1)/(colorstops-1); t=paint->p.gradient->stops[i].color.rgb; a1=255.0 * paint->p.gradient->stops[i].opacity; r1 = (t>>16) & 255; g1 = (t>>8) & 255; b1 = t & 255; t=paint->p.gradient->stops[i+1].color.rgb; a2=255.0 * paint->p.gradient->stops[i+1].opacity; r2 = (t>>16) & 255; g2 = (t>>8) & 255; b2 = t & 255; r2-=r1; g2-=g1; b2-=b1; a2-=a1; v=c2-c1-1; for(j=0;j<=v;++j) { c->gradient_colors[c1+j]=maprgb(c->surface, r1 + r2*j/v, g1 + g2*j/v, b1 + b2*j/v) | ((a1 + a2*j/v)<<24); } } c->gradient_policy = paint->p.gradient->spread; if (paint->p.gradient->type == SVG_GRADIENT_LINEAR) { c->renderfunc = lineargradient; c->gradient_p1 = (IPoint) { paint->p.gradient->u.linear.x1.value, paint->p.gradient->u.linear.y1.value}; c->gradient_p2 = (IPoint) { paint->p.gradient->u.linear.x2.value, paint->p.gradient->u.linear.y2.value}; } else if(paint->p.gradient->type == SVG_GRADIENT_RADIAL) { c->renderfunc = radialgradient; c->gradient_p1 = (IPoint) { paint->p.gradient->u.radial.cx.value, paint->p.gradient->u.radial.cy.value}; c->gradient_p2 = (IPoint) { paint->p.gradient->u.radial.fx.value, paint->p.gradient->u.radial.fy.value}; c->gradient_r = paint->p.gradient->u.radial.r.value; } else c->renderfunc = 0; if(paint->p.gradient->units==SVG_GRADIENT_UNITS_USER) { c->gradient_p1 = FixCoords(c, c->gradient_p1); c->gradient_p2 = FixCoords(c, c->gradient_p2); c->gradient_r = FixSizes(c, (IPoint) {c->gradient_r, 0.0}).x; } else // BBOX { c->gradient_p1 = (IPoint) {minx + c->gradient_p1.x * (maxx - minx + 1), miny + c->gradient_p1.y * (maxy - miny + 1)}; c->gradient_p2 = (IPoint) {minx + c->gradient_p2.x * (maxx - minx + 1), miny + c->gradient_p2.y * (maxy - miny + 1)}; c->gradient_r = c->gradient_r * (maxx - minx + 1); } break; default: c->renderfunc = 0; break; } do_render(c);} |
c->gradient_p1 = (IPoint) {minx + c->gradient_p1.x * (maxx - minx + 1), miny + c->gradient_p1.y * (maxy - miny + 1)}; c->gradient_p2 = (IPoint) {minx + c->gradient_p2.x * (maxx - minx + 1), miny + c->gradient_p2.y * (maxy - miny + 1)}; c->gradient_r = c->gradient_r * (maxx - minx + 1); | void svg_render_solid(SDL_svg_context *c){int i,j;int colorstops;//void (*renderfunc)(SDL_svg_context *c, int x, int y, int w);float minx, miny, maxx, maxy;IPoint *ip;IPoint *path;svg_paint_t *paint;const svg_color_t *rgb;int alpha; c->renderfunc = 0; path = c->path; minx=miny = 0x7fffffff; maxx=maxy =-0x7fffffff; for(i=0, ip=path;i<c->numpoints;++i,++ip) { if(ip->x<minx) minx=ip->x; if(ip->x>maxx) maxx=ip->x; if(ip->y<miny) miny=ip->y; if(ip->y>maxy) maxy=ip->y; } paint = c->paint; switch(paint->type) { case SVG_PAINT_TYPE_COLOR: rgb = &paint->p.color; alpha = 255.0 * c->FillOpacity; c->solidcolor = maprgb(c->surface, svg_color_get_red(rgb), svg_color_get_green(rgb), svg_color_get_blue(rgb)) | (alpha << 24); c->renderfunc = solidstrip; break; case SVG_PAINT_TYPE_GRADIENT: colorstops = paint->p.gradient->num_stops; for(i=0;i<colorstops-1;++i) { int c1,c2; int r1,g1,b1,a1,r2,g2,b2,a2; unsigned long t; int v; c1=NUM_GRADIENT_COLORS*i/(colorstops-1); c2=NUM_GRADIENT_COLORS*(i+1)/(colorstops-1); t=paint->p.gradient->stops[i].color.rgb; a1=255.0 * paint->p.gradient->stops[i].opacity; r1 = (t>>16) & 255; g1 = (t>>8) & 255; b1 = t & 255; t=paint->p.gradient->stops[i+1].color.rgb; a2=255.0 * paint->p.gradient->stops[i+1].opacity; r2 = (t>>16) & 255; g2 = (t>>8) & 255; b2 = t & 255; r2-=r1; g2-=g1; b2-=b1; a2-=a1; v=c2-c1-1; for(j=0;j<=v;++j) { c->gradient_colors[c1+j]=maprgb(c->surface, r1 + r2*j/v, g1 + g2*j/v, b1 + b2*j/v) | ((a1 + a2*j/v)<<24); } } c->gradient_policy = paint->p.gradient->spread; if (paint->p.gradient->type == SVG_GRADIENT_LINEAR) { c->renderfunc = lineargradient; c->gradient_p1 = (IPoint) { paint->p.gradient->u.linear.x1.value, paint->p.gradient->u.linear.y1.value}; c->gradient_p2 = (IPoint) { paint->p.gradient->u.linear.x2.value, paint->p.gradient->u.linear.y2.value}; } else if(paint->p.gradient->type == SVG_GRADIENT_RADIAL) { c->renderfunc = radialgradient; c->gradient_p1 = (IPoint) { paint->p.gradient->u.radial.cx.value, paint->p.gradient->u.radial.cy.value}; c->gradient_p2 = (IPoint) { paint->p.gradient->u.radial.fx.value, paint->p.gradient->u.radial.fy.value}; c->gradient_r = paint->p.gradient->u.radial.r.value; } else c->renderfunc = 0; if(paint->p.gradient->units==SVG_GRADIENT_UNITS_USER) { c->gradient_p1 = FixCoords(c, c->gradient_p1); c->gradient_p2 = FixCoords(c, c->gradient_p2); c->gradient_r = FixSizes(c, (IPoint) {c->gradient_r, 0.0}).x; } else // BBOX { c->gradient_p1 = (IPoint) {minx + c->gradient_p1.x * (maxx - minx + 1), miny + c->gradient_p1.y * (maxy - miny + 1)}; c->gradient_p2 = (IPoint) {minx + c->gradient_p2.x * (maxx - minx + 1), miny + c->gradient_p2.y * (maxy - miny + 1)}; c->gradient_r = c->gradient_r * (maxx - minx + 1); } break; default: c->renderfunc = 0; break; } do_render(c);} |
|
y[1]=lpuigs((GEN)x[1],m); y[2]=lpuigs((GEN)x[2],m); | y[1]=lpowgs((GEN)x[1],m); y[2]=lpowgs((GEN)x[2],m); | gpowgs(GEN x, long n){ long m, tx; pari_sp lim, av; static long gn[3] = {evaltyp(t_INT)|_evallg(3), 0, 0}; GEN y; if (n == 0) return puiss0(x); if (n == 1) return gcopy(x); if (n ==-1) return ginv(x); if (n>0) { gn[1] = evalsigne( 1) | evallgefint(3); gn[2]= n; } else { gn[1] = evalsigne(-1) | evallgefint(3); gn[2]=-n; } /* If gpowgs were only ever called from gpow, the switch wouldn't be needed. * In fact, under current word and bit field sizes, an integer power with * multiword exponent will always overflow. But it seems easier to call * puissii|powmodulo() with a mock-up GEN as 2nd argument than to write * separate versions for a long exponent. Note that n = HIGHBIT is an * invalid argument. --GN */ switch((tx=typ(x))) { case t_INT: { long sx=signe(x), sr = (sx<0 && (n&1))? -1: 1; if (n>0) return puissii(x,(GEN)gn,sr); if (!sx) err(talker, "division by zero in gpowgs"); if (is_pm1(x)) return (sr < 0)? icopy(x): gun; /* n<0, |x|>1 */ y=cgetg(3,t_FRAC); setsigne(gn,1); y[1]=(sr>0)? un: lnegi(gun); y[2]=(long)puissii(x,(GEN)gn,1); /* force denominator > 0 */ return y; } case t_INTMOD: y=cgetg(3,tx); copyifstack(x[1],y[1]); y[2]=(long)powmodulo((GEN)(x[2]),(GEN)gn,(GEN)(x[1])); return y; case t_FRAC: case t_FRACN: { GEN a = (GEN)x[1], b = (GEN)x[2]; long sr = (n&1 && (signe(a)!=signe(b))) ? -1 : 1; if (n > 0) { if (!signe(a)) return gzero; } else { /* n < 0 */ if (!signe(a)) err(talker, "division by zero fraction in gpowgs"); /* +-1/x[2] inverts to an integer */ if (is_pm1(a)) return puissii(b,(GEN)gn,sr); y = b; b = a; a = y; } /* HACK: puissii disregards the sign of gn */ y = cgetg(3,tx); y[1] = (long)puissii(a,(GEN)gn,sr); y[2] = (long)puissii(b,(GEN)gn,1); return y; } case t_PADIC: case t_POL: case t_POLMOD: return powgi(x,gn); case t_RFRAC: case t_RFRACN: { av=avma; y=cgetg(3,tx); m = labs(n); y[1]=lpuigs((GEN)x[1],m); y[2]=lpuigs((GEN)x[2],m); if (n<0) y=ginv(y); /* let ginv worry about normalizations */ return gerepileupto(av,y); } default: m = labs(n); av=avma; y=NULL; lim=stack_lim(av,1); for (; m>1; m>>=1) { if (m&1) y = y? gmul(y,x): x; x=gsqr(x); if (low_stack(lim, stack_lim(av,1))) { GEN *gptr[2]; gptr[0]=&x; gptr[1]=&y; if(DEBUGMEM>1) err(warnmem,"[3]: gpowgs"); gerepilemany(av,gptr,y? 2: 1); } } y = y? gmul(y,x): x; if (n<=0) y=ginv(y); return gerepileupto(av,y); }} |
GEN v = cgetg(q-1,t_VECSMALL); ulong h,qm3s2,qm1s2,qm1,a,i; ulong av = avma; | GEN v = cgetg(q-1,t_VECSMALL), w = v-1; ulong g,qm3s2,qm1s2,a,i; | computetabdl(ulong q){ GEN v = cgetg(q-1,t_VECSMALL); ulong h,qm3s2,qm1s2,qm1,a,i; ulong av = avma; h = itos(lift(gener(stoi(q)))); avma = av; qm3s2 = (q-3)>>1; qm1s2 = qm3s2+1; qm1 = q-1; v[q-2]=qm1s2; a=1; for (i=1; i<=qm3s2; i++) { a = mulssmod(h,a,q); v[a-1] = i; v[qm1-a] = i+qm1s2; } return v;} |
h = itos(lift(gener(stoi(q)))); avma = av; | g = u_gener(q); | computetabdl(ulong q){ GEN v = cgetg(q-1,t_VECSMALL); ulong h,qm3s2,qm1s2,qm1,a,i; ulong av = avma; h = itos(lift(gener(stoi(q)))); avma = av; qm3s2 = (q-3)>>1; qm1s2 = qm3s2+1; qm1 = q-1; v[q-2]=qm1s2; a=1; for (i=1; i<=qm3s2; i++) { a = mulssmod(h,a,q); v[a-1] = i; v[qm1-a] = i+qm1s2; } return v;} |
qm1 = q-1; v[q-2]=qm1s2; a=1; | w[q-1] = qm1s2; a = 1; | computetabdl(ulong q){ GEN v = cgetg(q-1,t_VECSMALL); ulong h,qm3s2,qm1s2,qm1,a,i; ulong av = avma; h = itos(lift(gener(stoi(q)))); avma = av; qm3s2 = (q-3)>>1; qm1s2 = qm3s2+1; qm1 = q-1; v[q-2]=qm1s2; a=1; for (i=1; i<=qm3s2; i++) { a = mulssmod(h,a,q); v[a-1] = i; v[qm1-a] = i+qm1s2; } return v;} |
a = mulssmod(h,a,q); v[a-1] = i; v[qm1-a] = i+qm1s2; | a = mulssmod(g,a,q); w[a] = i; w[q-a] = i+qm1s2; | computetabdl(ulong q){ GEN v = cgetg(q-1,t_VECSMALL); ulong h,qm3s2,qm1s2,qm1,a,i; ulong av = avma; h = itos(lift(gener(stoi(q)))); avma = av; qm3s2 = (q-3)>>1; qm1s2 = qm3s2+1; qm1 = q-1; v[q-2]=qm1s2; a=1; for (i=1; i<=qm3s2; i++) { a = mulssmod(h,a,q); v[a-1] = i; v[qm1-a] = i+qm1s2; } return v;} |
long d = itos(D), t, b2, a, b, c, h, dover3 = labs(d)/3; GEN z, L = cgetg((long)sqrt(dover3), t_VEC); | long d = itos(D), dabs = labs(d), dover3 = dabs/3, t, b2, a, b, c, h; GEN z, L = cgetg((long)sqrt(dabs) * log2(dabs), t_VEC); | getallforms(GEN D, long *pth, GEN *ptz){ long d = itos(D), t, b2, a, b, c, h, dover3 = labs(d)/3; GEN z, L = cgetg((long)sqrt(dover3), t_VEC); b2 = b = (d&1); h = 0; z=gun; while (b2 <= dover3) { t = (b2-d)/4; for (a=b?b:1; a*a<=t; a++) if (t%a == 0) { c = t/a; z = mulsi(a,z); L[++h] = (long)qfi(stoi(a),stoi(b),stoi(c)); if (b && a != b && a*a != t) L[++h] = (long)qfi(stoi(a),stoi(-b),stoi(c)); } b+=2; b2=b*b; } *pth = h; *ptz = z; setlg(L,h+1); return L;} |
size_t last = M->last-M->base, chk = M->chk-M->base, end = M->end - M->base; M->base = (REL_t*)gprealloc((void*)M->base, (len+1) * sizeof(REL_t)); M->last = M->base + last; M->chk = M->base + chk; M->end = M->base + end; M->len = len; | REL_t *old = M->base; M->len = len; M->base = (REL_t*)gprealloc((void*)old, (len+1) * sizeof(REL_t)); if (old) { size_t last = M->last - old, chk = M->chk - old, end = M->end - old; M->last = M->base + last; M->chk = M->base + chk; M->end = M->base + end; } | reallocate(RELCACHE_t *M, long len){ size_t last = M->last-M->base, chk = M->chk-M->base, end = M->end - M->base; M->base = (REL_t*)gprealloc((void*)M->base, (len+1) * sizeof(REL_t)); M->last = M->base + last; M->chk = M->base + chk; M->end = M->base + end; M->len = len;} |
long tx = typ(x), av = avma, tetpil; | ulong tx = typ(x), av = avma, tetpil; | compreal0(GEN x, GEN y, int raw){ long tx = typ(x), av = avma, tetpil; GEN z; if (typ(y) != tx || tx!=t_QFR) err(typeer,"composition"); z=cgetg(5,t_QFR); comp_gen(z,x,y); z[4]=laddrr((GEN)x[4],(GEN)y[4]); tetpil=avma; return gerepile(av,tetpil, raw? gcopy(z): redreal(z));} |
* Set up mbuf data strutures * Cluster allocation *must* come first -- see comment on kmem_malloc(). | * Set up mbuf cluster data strutures | bsd_init (){ /* * Set up mbuf data strutures * Cluster allocation *must* come first -- see comment on kmem_malloc(). */ m_clalloc (nmbclusters, M_DONTWAIT); mclrefcnt = malloc (nmbclusters); if (mclrefcnt == NULL) rtems_panic ("No memory for mbuf cluster reference counts."); memset (mclrefcnt, '\0', nmbclusters); m_mballoc (nmbuf, M_DONTWAIT); mbstat.m_mtypes[MT_FREE] = nmbuf; /* * Set up domains */ { extern struct domain routedomain; extern struct domain inetdomain; routedomain.dom_next = domains; domains = &routedomain; inetdomain.dom_next = domains; domains = &inetdomain; domaininit (NULL); } /* * Set up interfaces */ ifinit (NULL);} |
m_clalloc (nmbclusters, M_DONTWAIT); | p = malloc ((nmbclusters*MCLBYTES)+MCLBYTES-1); p = (char *)(((unsigned long)p + (MCLBYTES-1)) & ~(MCLBYTES-1)); if (p == NULL) rtems_panic ("Can't get network cluster memory."); mbutl = (struct mbuf *)p; for (i = 0; i < nmbclusters; i++) { ((union mcluster *)p)->mcl_next = mclfree; mclfree = (union mcluster *)p; p += MCLBYTES; mbstat.m_clfree++; } mbstat.m_clusters = nmbclusters; | bsd_init (){ /* * Set up mbuf data strutures * Cluster allocation *must* come first -- see comment on kmem_malloc(). */ m_clalloc (nmbclusters, M_DONTWAIT); mclrefcnt = malloc (nmbclusters); if (mclrefcnt == NULL) rtems_panic ("No memory for mbuf cluster reference counts."); memset (mclrefcnt, '\0', nmbclusters); m_mballoc (nmbuf, M_DONTWAIT); mbstat.m_mtypes[MT_FREE] = nmbuf; /* * Set up domains */ { extern struct domain routedomain; extern struct domain inetdomain; routedomain.dom_next = domains; domains = &routedomain; inetdomain.dom_next = domains; domains = &inetdomain; domaininit (NULL); } /* * Set up interfaces */ ifinit (NULL);} |
rtems_panic ("No memory for mbuf cluster reference counts."); | rtems_panic ("Can't get mbuf cluster reference counts memory."); | bsd_init (){ /* * Set up mbuf data strutures * Cluster allocation *must* come first -- see comment on kmem_malloc(). */ m_clalloc (nmbclusters, M_DONTWAIT); mclrefcnt = malloc (nmbclusters); if (mclrefcnt == NULL) rtems_panic ("No memory for mbuf cluster reference counts."); memset (mclrefcnt, '\0', nmbclusters); m_mballoc (nmbuf, M_DONTWAIT); mbstat.m_mtypes[MT_FREE] = nmbuf; /* * Set up domains */ { extern struct domain routedomain; extern struct domain inetdomain; routedomain.dom_next = domains; domains = &routedomain; inetdomain.dom_next = domains; domains = &inetdomain; domaininit (NULL); } /* * Set up interfaces */ ifinit (NULL);} |
m_mballoc (nmbuf, M_DONTWAIT); | p = malloc(nmbuf * MSIZE); if (p == NULL) rtems_panic ("Can't get network memory."); for (i = 0; i < nmbuf; i++) { ((struct mbuf *)p)->m_next = mmbfree; mmbfree = (struct mbuf *)p; p += MSIZE; } mbstat.m_mbufs = nmbuf; | bsd_init (){ /* * Set up mbuf data strutures * Cluster allocation *must* come first -- see comment on kmem_malloc(). */ m_clalloc (nmbclusters, M_DONTWAIT); mclrefcnt = malloc (nmbclusters); if (mclrefcnt == NULL) rtems_panic ("No memory for mbuf cluster reference counts."); memset (mclrefcnt, '\0', nmbclusters); m_mballoc (nmbuf, M_DONTWAIT); mbstat.m_mtypes[MT_FREE] = nmbuf; /* * Set up domains */ { extern struct domain routedomain; extern struct domain inetdomain; routedomain.dom_next = domains; domains = &routedomain; inetdomain.dom_next = domains; domains = &inetdomain; domaininit (NULL); } /* * Set up interfaces */ ifinit (NULL);} |
char new_name[ NAME_MAX + 1 ]; | char new_name[ IMFS_NAME_MAX + 1 ]; | int IMFS_mknod( const char *token, /* IN */ mode_t mode, /* IN */ dev_t dev, /* IN */ rtems_filesystem_location_info_t *pathloc /* IN/OUT */){ IMFS_token_types type = 0; IMFS_jnode_t *new_node; int result; char new_name[ NAME_MAX + 1 ]; IMFS_types_union info; IMFS_get_token( token, new_name, &result ); /* * Figure out what type of IMFS node this is. */ if ( S_ISDIR(mode) ) type = IMFS_DIRECTORY; else if ( S_ISREG(mode) ) type = IMFS_MEMORY_FILE; else if ( S_ISBLK(mode) || S_ISCHR(mode) ) { type = IMFS_DEVICE; rtems_filesystem_split_dev_t( dev, info.device.major, info.device.minor ); } else { assert( 0 ); set_errno_and_return_minus_one( EINVAL ); } /* * Allocate and fill in an IMFS jnode */ new_node = IMFS_create_node( pathloc, type, new_name, mode, &info ); if ( !new_node ) set_errno_and_return_minus_one( ENOMEM ); return 0;} |
if (!form1) form1 = initrealform5(ex); if (!first) form1 = comprealform(form1, realpf5(Disc, FB[current])); | if (!form1) { form1 = initrealform5(ex); if (!first) form1 = comprealform(form1, realpf5(Disc, FB[current])); } | real_relations(long LIM, long lim, long LIMC, long **mat){ long lgsub = lg(subFB), i, s, fpc, current, nbtest = 0, endcycle, rhoacc, rho; int first = 1; pari_sp av, av1, limstack; GEN C, d, col, form, form0, form1, ex = cgetg(lgsub, t_VECSMALL); C = cgetg(LIM+1, t_VEC); for (i=1; i<=LIM; i++) C[i] = lgetr(PRECREG); current = 0; av = avma; limstack = stack_lim(av,1); s = trivial_relations(mat, C); lim += s; if (lim > LIM) lim = LIM;NEW: for(;;) { if (s >= lim) { if (lim == LIM) break; lim = LIM; first = 0; if (DEBUGLEVEL) dbg_all(0, s, nbtest); } avma = av; form = real_random_form(ex); if (!first) { current = 1+s-RELSUP; form = comprealform3(form, realpf(Disc, FB[current])); } av1 = avma; form0 = form; form1 = NULL; endcycle = rhoacc = 0; rho = -1;CYCLE: if (endcycle) goto NEW; if (low_stack(limstack, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"real_relations"); gerepileall(av1, form1? 2: 1, &form, &form1); } if (rho < 0) rho = 0; /* first time in */ else { form = rhorealform(form); rho++; rhoacc++; if (first) endcycle = (absi_equal((GEN)form[1],(GEN)form0[1]) && egalii((GEN)form[2],(GEN)form0[2]) && (!narrow || signe(form0[1])==signe(form[1]))); else { if (narrow) { form = rhorealform(form); rho++; } else if (absi_equal((GEN)form[1], (GEN)form[3])) /* a = -c */ { if (absi_equal((GEN)form[1],(GEN)form0[1]) && egalii((GEN)form[2],(GEN)form0[2])) goto NEW; form = rhorealform(form); rho++; } else { setsigne(form[1],1); setsigne(form[3],-1); } if (egalii((GEN)form[1],(GEN)form0[1]) && egalii((GEN)form[2],(GEN)form0[2])) goto NEW; } } nbtest++; fpc = factorquad(form,KC,LIMC); if (!fpc) { if (DEBUGLEVEL>1) fprintferr("."); goto CYCLE; } if (fpc > 1) { /* look for Large Prime relation */ long *fpd = largeprime(fpc,ex,current,rhoacc); long b1, b2, p; GEN form2; if (!fpd) { if (DEBUGLEVEL>1) fprintferr("."); goto CYCLE; } if (!form1) form1 = initrealform5(ex); if (!first) form1 = comprealform(form1, realpf5(Disc, FB[current])); form1 = rhoreal_pow(form1, rho); rho = 0; form2 = initrealform5(fpd); if (fpd[-2]) form2 = comprealform(form2, realpf5(Disc, FB[fpd[-2]])); form2 = rhoreal_pow(form2, fpd[-3]); if (!narrow && !absi_equal((GEN)form2[1],(GEN)form2[3])) { setsigne(form2[1],1); setsigne(form2[3],-1); } p = fpc << 1; b1 = smodis((GEN)form2[2], p); b2 = smodis((GEN)form1[2], p); if (b1 != b2 && b1+b2 != p) goto CYCLE; col = mat[++s]; add_fact(col, form1); (void)factorquad(form2,KC,LIMC); if (b1==b2) { for (i=1; i<lgsub; i++) col[subFB[i]] += fpd[i]-ex[i]; sub_fact(col, form2); if (fpd[-2]) col[fpd[-2]]++; /* implies !first */ d = get_dist(subii((GEN)form1[4],(GEN)form2[4]), divrr((GEN)form1[5],(GEN)form2[5]), PRECREG); } else { for (i=1; i<lgsub; i++) col[subFB[i]] += -fpd[i]-ex[i]; add_fact(col, form2); if (fpd[-2]) col[fpd[-2]]--; d = get_dist(addii((GEN)form1[4],(GEN)form2[4]), mulrr((GEN)form1[5],(GEN)form2[5]), PRECREG); } } else { /* standard relation */ if (!form1) form1 = initrealform5(ex); if (!first) form1 = comprealform(form1, realpf5(Disc, FB[current])); form1 = rhoreal_pow(form1,rho); rho = 0; col = mat[++s]; for (i=1; i<lgsub; i++) col[subFB[i]] = -ex[i]; add_fact(col, form1); d = get_dist((GEN)form1[4], (GEN)form1[5], PRECREG); } if (DEBUGLEVEL) fprintferr(" %ld",s); affrr(d, (GEN)C[s]); if (first) { if (s >= lim) goto NEW; goto CYCLE; } else { col[current]--; if (fpc == 1 && col[current] == 0) { s--; for (i=1; i<=KC; i++) col[i]=0; } } } if (DEBUGLEVEL) dbg_all(1, s, nbtest); return C;} |
if (gcmp1(gel(Q,1)) && !signe(gel(Q,2))) { c = gel(Q,3); if (kronecker(negi(c), p) < 0) { avma = av; return gen_0; } avma = av; if (!cornacchia(c, p, &M,&N)) return gen_0; goto END; | if (!signe(gel(Q,2))) { a = gel(Q,1); c = gel(Q,3); if (gcmp1(a)) return qfbsolve_cornacchia(c, p, 0); if (gcmp1(c)) return qfbsolve_cornacchia(a, p, 1); | qfbimagsolvep(GEN Q, GEN p){ GEN M, N, x,y, a,b,c, d; pari_sp av = avma; if (gcmp1(gel(Q,1)) && !signe(gel(Q,2))) { /* principal form. Use faster cornacchia */ c = gel(Q,3); if (kronecker(negi(c), p) < 0) { avma = av; return gen_0; } avma = av; if (!cornacchia(c, p, &M,&N)) return gen_0; goto END; } d = qf_disc(Q); if (kronecker(d,p) < 0) return gen_0; a = redimagsl2(Q, &N); b = redimagsl2(primeform(d, p, 0), &M); if (!gequal(a, b)) return gen_0; a = gcoeff(M,1,1); x = gcoeff(N,1,1); b = gcoeff(M,1,2); y = gcoeff(N,1,2); c = gcoeff(M,2,1); d = gcoeff(M,2,2); /* inverse: [d,-b; -c,a]. Return (N/M)[1] */ M = subii(mulii(d,x), mulii(b,y)); N = subii(mulii(a,y), mulii(c,x));END: return gerepilecopy(av, mkvec2(M,N));} |
a = gcoeff(M,1,1); x = gcoeff(N,1,1); b = gcoeff(M,1,2); y = gcoeff(N,1,2); c = gcoeff(M,2,1); d = gcoeff(M,2,2); M = subii(mulii(d,x), mulii(b,y)); N = subii(mulii(a,y), mulii(c,x)); END: return gerepilecopy(av, mkvec2(M,N)); | a = gcoeff(N,1,1); x = gcoeff(M,2,2); b = gcoeff(N,1,2); y = gcoeff(M,2,1); c = gcoeff(N,2,1); d = gcoeff(N,2,2); M = subii(mulii(a,x), mulii(b,y)); N = subii(mulii(c,x), mulii(d,x)); return gerepilecopy(av, mkvec2(M,N)); | qfbimagsolvep(GEN Q, GEN p){ GEN M, N, x,y, a,b,c, d; pari_sp av = avma; if (gcmp1(gel(Q,1)) && !signe(gel(Q,2))) { /* principal form. Use faster cornacchia */ c = gel(Q,3); if (kronecker(negi(c), p) < 0) { avma = av; return gen_0; } avma = av; if (!cornacchia(c, p, &M,&N)) return gen_0; goto END; } d = qf_disc(Q); if (kronecker(d,p) < 0) return gen_0; a = redimagsl2(Q, &N); b = redimagsl2(primeform(d, p, 0), &M); if (!gequal(a, b)) return gen_0; a = gcoeff(M,1,1); x = gcoeff(N,1,1); b = gcoeff(M,1,2); y = gcoeff(N,1,2); c = gcoeff(M,2,1); d = gcoeff(M,2,2); /* inverse: [d,-b; -c,a]. Return (N/M)[1] */ M = subii(mulii(d,x), mulii(b,y)); N = subii(mulii(a,y), mulii(c,x));END: return gerepilecopy(av, mkvec2(M,N));} |
static void m_reclaim __P((void)); | SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbinit, NULL)struct mbuf *mbutl;char *mclrefcnt;struct mbstat mbstat;struct mbuf *mmbfree;union mcluster *mclfree;int max_linkhdr;int max_protohdr;int max_hdr;int max_datalen;static void m_reclaim __P((void));/* "number of clusters of pages" */#define NCL_INIT 1#define NMB_INIT 16/* ARGSUSED*/static voidmbinit(dummy) void *dummy;{ int s; mmbfree = NULL; mclfree = NULL; s = splimp(); if (m_mballoc(NMB_INIT, M_DONTWAIT) == 0) goto bad; if (m_clalloc(NCL_INIT, M_DONTWAIT) == 0) goto bad; splx(s); return;bad: panic("mbinit");} |
|
static void mbinit(dummy) void *dummy; | struct mbuf * m_retry(i, t) int i, t; | SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbinit, NULL)struct mbuf *mbutl;char *mclrefcnt;struct mbstat mbstat;struct mbuf *mmbfree;union mcluster *mclfree;int max_linkhdr;int max_protohdr;int max_hdr;int max_datalen;static void m_reclaim __P((void));/* "number of clusters of pages" */#define NCL_INIT 1#define NMB_INIT 16/* ARGSUSED*/static voidmbinit(dummy) void *dummy;{ int s; mmbfree = NULL; mclfree = NULL; s = splimp(); if (m_mballoc(NMB_INIT, M_DONTWAIT) == 0) goto bad; if (m_clalloc(NCL_INIT, M_DONTWAIT) == 0) goto bad; splx(s); return;bad: panic("mbinit");} |
int s; | register struct mbuf *m; | SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbinit, NULL)struct mbuf *mbutl;char *mclrefcnt;struct mbstat mbstat;struct mbuf *mmbfree;union mcluster *mclfree;int max_linkhdr;int max_protohdr;int max_hdr;int max_datalen;static void m_reclaim __P((void));/* "number of clusters of pages" */#define NCL_INIT 1#define NMB_INIT 16/* ARGSUSED*/static voidmbinit(dummy) void *dummy;{ int s; mmbfree = NULL; mclfree = NULL; s = splimp(); if (m_mballoc(NMB_INIT, M_DONTWAIT) == 0) goto bad; if (m_clalloc(NCL_INIT, M_DONTWAIT) == 0) goto bad; splx(s); return;bad: panic("mbinit");} |
mmbfree = NULL; mclfree = NULL; s = splimp(); if (m_mballoc(NMB_INIT, M_DONTWAIT) == 0) goto bad; if (m_clalloc(NCL_INIT, M_DONTWAIT) == 0) goto bad; splx(s); return; bad: panic("mbinit"); | m_reclaim(); #define m_retry(i, t) (struct mbuf *)0 MGET(m, i, t); #undef m_retry if (m != NULL) mbstat.m_wait++; else mbstat.m_drops++; return (m); | SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbinit, NULL)struct mbuf *mbutl;char *mclrefcnt;struct mbstat mbstat;struct mbuf *mmbfree;union mcluster *mclfree;int max_linkhdr;int max_protohdr;int max_hdr;int max_datalen;static void m_reclaim __P((void));/* "number of clusters of pages" */#define NCL_INIT 1#define NMB_INIT 16/* ARGSUSED*/static voidmbinit(dummy) void *dummy;{ int s; mmbfree = NULL; mclfree = NULL; s = splimp(); if (m_mballoc(NMB_INIT, M_DONTWAIT) == 0) goto bad; if (m_clalloc(NCL_INIT, M_DONTWAIT) == 0) goto bad; splx(s); return;bad: panic("mbinit");} |
u = u_FpX_div(u,a,pp,0); | u = u_FpX_div(u,a,pp); | FpX_extgcd_long(GEN x, GEN y, GEN p, GEN *ptu, GEN *ptv){ ulong pp = (ulong)p[2]; GEN a,b,q,r,u,v,v1,d,d1; long av = avma, vx; a = u_Fp_FpX(x,0, pp); b = u_Fp_FpX(y,0, pp); d = a; d1 = b; v = u_zeropol(0); v1= u_Fp_FpX(polun[0],0, pp); while (signe(d1)) { q = u_FpX_divrem(d,d1,pp, 0,&r); v = u_FpX_sub(v, u_FpX_mul(q,v1, pp), pp); /* v -= q v1 */ u=v; v=v1; v1=u; u=r; d=d1; d1=u; } u = u_FpX_sub(d, u_FpX_mul(b,v,pp), pp); u = u_FpX_div(u,a,pp,0); *ptu = u; *ptv = v; { GEN *gptr[3]; gptr[0] = &d; gptr[1] = ptu; gptr[2] = ptv; u_gerepilemany(av, gptr, 3); } vx = varn(x); setvarn(*ptu,vx); setvarn(*ptv,vx); setvarn(d,vx); return d;} |
if (d < 0) err(zeropoler,"FpX_factor_2"); | FpX_factor_2(GEN f, GEN p, long d){ GEN r, s, R, S; long v; int sgn; if (!d) return trivfact(); if (d == 1) return mkmat2(mkcol(f), mkvecsmall(1)); r = FpX_quad_root(f, p, 1); if (!r) return mkmat2(mkcol(f), mkvecsmall(1)); v = varn(f); s = otherroot(f, r, p); if (signe(r)) r = subii(p, r); if (signe(s)) s = subii(p, s); sgn = cmpii(s, r); if (sgn < 0) swap(s,r); R = deg1pol_i(gen_1, r, v); if (!sgn) return mkmat2(mkcol(R), mkvecsmall(2)); S = deg1pol_i(gen_1, s, v); return mkmat2(mkcol2(R,S), mkvecsmall2(1,1));} |
|
W = modii(mulii(Wr,Fp_poleval(deriv(Tr,x),Sr,q)),qold); | W = modii(mulii(Wr,Fp_poleval(deriv(Tr,x),Sr,qold)),qold); | rootpadiclift(GEN T, GEN S, GEN q, GEN Q){ ulong ltop=avma; long x; GEN qold; GEN W, Tr, Sr, Wr = gzero; int flag, init; x = varn(T); qold = q ; Tr = Fp_pol_red(T,q); W=Fp_poleval(deriv(Tr, x),S,q); W=mpinvmod(W,q); flag = 1; init = 0; while (flag) { q = sqri(q); if (cmpii(q,Q)>= 0) { flag = 0; q = Q; } Tr = Fp_pol_red(T,q); Sr = S; if (init) { W = modii(mulii(Wr,Fp_poleval(deriv(Tr,x),Sr,q)),qold); W = subii(gdeux,W); W = modii(mulii(Wr, W),qold); } else init = 1; Wr = W; S = subii(Sr, mulii(Wr, Fp_poleval(Tr, Sr,q))); S = modii(S,q); qold = q; } return gerepileupto(ltop,S);} |
S = init_pow_q_mod_pT(X, q, u, T, p); | S = init_spec_FqXQ_pow(X, q, u, T, p); | FqX_split_by_degree(GEN *pz, GEN u, GEN q, GEN T, GEN p){ long nb = 0, d, dg, N = degpol(u); GEN v, S, g, X, z = cget1(N+1, t_VEC); *pz = z; if (N == 1) return 1; v = X = polx[varn(u)]; S = init_pow_q_mod_pT(X, q, u, T, p); appendL(z, S); for (d=1; d <= N>>1; d++) { v = spec_FqXQ_pow(v, S, T, p); g = FqX_gcd(gsub(v,X),u, T,p); dg = degpol(g); if (dg <= 0) continue; /* all factors of g have degree d */ add(z, g, dg / d); nb += dg / d; N -= dg; if (N) { u = FqX_div(u,g, T,p); v = FqX_rem(v,u, T,p); } } if (N) { add(z, u, 1); nb++; } return nb;} |
setlg(E, nbfact); return sort_factor(mkvec2((GEN)t,E), cmpii); | setlg(E, nbfact); return sort_factor(mkmat2((GEN)t,E), cmpii); | FpX_factor_i(GEN f, GEN pp){ long e, N, nbfact, val, d = degpol(f); ulong p, k, j; GEN pps2, E, f2, p1, g1, u, *t; if (!d) return trivfact(); p = init_p(pp); /* to hold factors and exponents */ t = (GEN*)cgetg(d+1,t_COL); E = cgetg(d+1,t_VECSMALL); val = ZX_valuation(f, &f); e = nbfact = 1; if (val) { t[1] = polx[varn(f)]; E[1] = val; nbfact++; } pps2 = shifti(pp,-1); for(;;) { f2 = FpX_gcd(f,derivpol(f), pp); g1 = lg(f2)==3? f: FpX_div(f,f2,pp); k = 0; while (lg(g1)>3) { k++; if (p && !(k%p)) { k++; f2 = FpX_div(f2,g1,pp); } p1 = FpX_gcd(f2,g1, pp); u = g1; g1 = p1; if (degpol(p1)) { u = FpX_div( u,p1,pp); f2= FpX_div(f2,p1,pp); } /* u is square-free (product of irred. of multiplicity e * k) */ N = degpol(u); if (N > 0) { t[nbfact] = FpX_normalize(u,pp); d = (N==1)? 1: FpX_split_Berlekamp(t+nbfact, pp); for (j=0; j<(ulong)d; j++) E[nbfact+j] = e*k; nbfact += d; } } if (!p) break; j = degpol(f2); if (!j) break; if (j % p) err(talker, "factmod: %lu is not prime", p); e *= p; f = poldeflate_i(f2, p); } setlg(t, nbfact); setlg(E, nbfact); return sort_factor(mkvec2((GEN)t,E), cmpii);} |
long e, d, m, i, lx; GEN y; | floorr(GEN x){ if (signe(x) >= 0) return truncr(x); if ((e=expo(x)) < 0) return stoi(-1); d = (e>>TWOPOTBITS_IN_LONG) + 3; m = e & (BITS_IN_LONG-1); lx=lg(x); if (d>lx) err(precer, "floorr (precision loss in truncation)"); y = cgeti(d+1); if (++m == BITS_IN_LONG) { for (i=2; i<d; i++) y[d-i+1]=x[i]; i=d; while (i<lx && !x[i]) i++; if (i==lx) goto END; } else { GEN z=cgeti(d); for (i=2; i<d; i++) z[d-i+1]=x[i]; mpn_rshift(LIMBS(y),LIMBS(z),d-2,BITS_IN_LONG-m); if (x[d-1]<<m == 0) { i=d; while (i<lx && !x[i]) i++; if (i==lx) goto END; } } if (mpn_add_1(LIMBS(y),LIMBS(y),d-2,1)) y[d++]=1; END: y[1] = evalsigne(-1) | evallgefint(d); return y;} |
|
int rval; XlatRec l; l.aspace = as; l.address = aIn; l.reverse = reverse; rval = mapOverAll(master,xlatePort,(void*)&l) - 1; *paOut = l.address; return rval; | DFLT_BASE; return vmeUniverseXlateAddrXX(base, master, reverse, as, aIn, paOut); | vmeUniverseXlateAddr( int master, /* look in the master windows */ int reverse, /* reverse mapping; for masters: map local to VME */ unsigned long as, /* address space */ unsigned long aIn, /* address to look up */ unsigned long *paOut/* where to put result */ ){int rval;XlatRec l; l.aspace = as; l.address = aIn; l.reverse = reverse; /* map result -1/0/1 to -2/-1/0 with 0 on success */ rval = mapOverAll(master,xlatePort,(void*)&l) - 1; *paOut = l.address; return rval;} |
signal_set = asr->signals_posted; if ( signal_set ) { asr->signals_posted = 0; _ISR_Enable( level ); asr->nest_level += 1; rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode ); (*asr->handler)( signal_set ); asr->nest_level -= 1; rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode ); } else _ISR_Enable( level ); | asr->nest_level -= 1; rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode ); | User_extensions_routine _RTEMS_tasks_Switch_extension( Thread_Control *executing){ ISR_Level level; RTEMS_API_Control *api; ASR_Information *asr; rtems_signal_set signal_set; Modes_Control prev_mode; api = executing->API_Extensions[ THREAD_API_RTEMS ]; asr = &api->Signal; _ISR_Disable( level ); signal_set = asr->signals_posted; if ( signal_set ) { /* if ( _ASR_Are_signals_pending( asr ) ) { signal_set = asr->signals_posted; */ asr->signals_posted = 0; _ISR_Enable( level ); asr->nest_level += 1; rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode ); (*asr->handler)( signal_set ); asr->nest_level -= 1; rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode ); } else _ISR_Enable( level );} |
GEN z = gmael(L,1,1); | GEN z = gel(L,1); if (typ(z) != t_VEC) err(typeer, s); if (lg(z) == 1) return; z = gel(L,1); | chk_listBU(GEN L, char *s) { if (typ(L) != t_VEC) err(typeer,s); if (lg(L) > 1) { GEN z = gmael(L,1,1); /* [bid,U] */ if (typ(z) != t_VEC || lg(z) != 3) err(typeer, s); checkbid(gel(z,1)); }} |
rtems_unsigned32 t; | uint32_t t; | int Read_timer( void ){ rtems_unsigned32 t; unsigned long long total; t = MC9328MXL_TMR2_TCN; /* * Total is calculated by taking into account the number of timer overflow * interrupts since the timer was initialized and clicks since the last * interrupts. */ total = (t - g_start); /* convert to nanoseconds */ total = (total * 1000)/ g_freq; if ( Timer_driver_Find_average_overhead == 1 ) { return (int) total; } else if ( total < LEAST_VALID ) { return 0; } /* * Somehow convert total into microseconds */ return (total - AVG_OVERHEAD);} |
int lfa, i, j; | long lfa, i, j; | e(ulong t, GEN *globfa){ GEN fa, P, E, s, Primes; ulong nbd, m, k, d; int lfa, i, j; fa = factoru(t); P = (GEN)fa[1]; E = (GEN)fa[2]; lfa = lg(P); nbd = 1; for (i=1; i<lfa; i++) { E[i]++; nbd *= E[i]; } Primes = cget1(nbd + 1, t_VECSMALL); s = gen_2; /* nbd = number of divisors */ for (k=0; k<nbd; k++) { m = k; d = 1; for (j=1; m; j++) { d *= u_pow(P[j], m % E[j]); m /= E[j]; } /* d runs through the divisors of t */ if (BSW_psp(utoipos(++d))) { if (d != 2) appendL(Primes, (GEN)d); s = muliu(s, (ulong)u_pow(d, 1 + u_lval(t,d))); } } if (globfa) { vecsmall_sort(Primes); *globfa = Primes; } return s;} |
d *= u_pow(P[j], m % E[j]); | d *= npownn(P[j], m % E[j]); | e(ulong t, GEN *globfa){ GEN fa, P, E, s, Primes; ulong nbd, m, k, d; int lfa, i, j; fa = factoru(t); P = (GEN)fa[1]; E = (GEN)fa[2]; lfa = lg(P); nbd = 1; for (i=1; i<lfa; i++) { E[i]++; nbd *= E[i]; } Primes = cget1(nbd + 1, t_VECSMALL); s = gen_2; /* nbd = number of divisors */ for (k=0; k<nbd; k++) { m = k; d = 1; for (j=1; m; j++) { d *= u_pow(P[j], m % E[j]); m /= E[j]; } /* d runs through the divisors of t */ if (BSW_psp(utoipos(++d))) { if (d != 2) appendL(Primes, (GEN)d); s = muliu(s, (ulong)u_pow(d, 1 + u_lval(t,d))); } } if (globfa) { vecsmall_sort(Primes); *globfa = Primes; } return s;} |
s = muliu(s, (ulong)u_pow(d, 1 + u_lval(t,d))); | s = muliu(s, (ulong)npownn(d, 1 + u_lval(t,d))); | e(ulong t, GEN *globfa){ GEN fa, P, E, s, Primes; ulong nbd, m, k, d; int lfa, i, j; fa = factoru(t); P = (GEN)fa[1]; E = (GEN)fa[2]; lfa = lg(P); nbd = 1; for (i=1; i<lfa; i++) { E[i]++; nbd *= E[i]; } Primes = cget1(nbd + 1, t_VECSMALL); s = gen_2; /* nbd = number of divisors */ for (k=0; k<nbd; k++) { m = k; d = 1; for (j=1; m; j++) { d *= u_pow(P[j], m % E[j]); m /= E[j]; } /* d runs through the divisors of t */ if (BSW_psp(utoipos(++d))) { if (d != 2) appendL(Primes, (GEN)d); s = muliu(s, (ulong)u_pow(d, 1 + u_lval(t,d))); } } if (globfa) { vecsmall_sort(Primes); *globfa = Primes; } return s;} |
GEN liste = gel(bid,4), arch = gmael(bid,1,2); return F2V_red_ip(gmul(gmael(liste, lg(liste)-1, 3), rowextract_p(sgnU, arch_to_perm(arch)))); | GEN U, liste = gel(bid,4), arch = gmael(bid,1,2); long i; U = gmul(gmael(liste, lg(liste)-1, 3), rowextract_p(sgnU, arch_to_perm(arch))); for (i = 1; i < lg(U); i++) F2V_red_ip(gel(U,i)); return U; | zlog_unitsarch(GEN sgnU, GEN bid){ GEN liste = gel(bid,4), arch = gmael(bid,1,2); return F2V_red_ip(gmul(gmael(liste, lg(liste)-1, 3), rowextract_p(sgnU, arch_to_perm(arch))));} |
long lx,i, tx=typ(x); GEN p1,p2,y; | long lx, i, tx=typ(x); GEN p1, y; | gnorm(GEN x){ pari_sp av; long lx,i, tx=typ(x); GEN p1,p2,y; switch(tx) { case t_INT: return sqri(x); case t_REAL: return mulrr(x,x); case t_FRAC: return gsqr(x); case t_COMPLEX: av = avma; return gerepileupto(av, gadd(gsqr((GEN)x[1]), gsqr((GEN)x[2]))); case t_QUAD: av = avma; p1 = (GEN)x[1]; p2 = gmul((GEN)p1[2], gsqr((GEN)x[3])); p1 = gcmp0((GEN)p1[3])? gsqr((GEN)x[2]) : gmul((GEN)x[2], gadd((GEN)x[2],(GEN)x[3])); return gerepileupto(av, gadd(p1,p2)); case t_POL: case t_SER: case t_RFRAC: av = avma; return gerepileupto(av, greal(gmul(gconj(x),x))); case t_POLMOD: { GEN T = (GEN)x[1], A = (GEN)x[2]; if (typ(A) != t_POL) return gpowgs(A, degpol(T)); y = subres(T, A); p1 = leading_term(T); if (gcmp1(p1) || gcmp0(A)) return y; av = avma; T = gpowgs(p1, degpol(A)); return gerepileupto(av, gdiv(y,T)); } case t_VEC: case t_COL: case t_MAT: lx=lg(x); y=cgetg(lx,tx); for (i=1; i<lx; i++) y[i]=lnorm((GEN) x[i]); return y; } err(typeer,"gnorm"); return NULL; /* not reached */} |
p1 = (GEN)x[1]; p2 = gmul((GEN)p1[2], gsqr((GEN)x[3])); p1 = gcmp0((GEN)p1[3])? gsqr((GEN)x[2]) : gmul((GEN)x[2], gadd((GEN)x[2],(GEN)x[3])); return gerepileupto(av, gadd(p1,p2)); | { GEN u = (GEN)x[3], v = (GEN)x[2]; GEN X = (GEN)x[1], b = (GEN)X[3], c = (GEN)X[2]; p1 = gcmp0(b)? gsqr(v): gmul(v, gadd(u,v)); return gerepileupto(av, gadd(p1, gmul(c, gsqr(u)))); } | gnorm(GEN x){ pari_sp av; long lx,i, tx=typ(x); GEN p1,p2,y; switch(tx) { case t_INT: return sqri(x); case t_REAL: return mulrr(x,x); case t_FRAC: return gsqr(x); case t_COMPLEX: av = avma; return gerepileupto(av, gadd(gsqr((GEN)x[1]), gsqr((GEN)x[2]))); case t_QUAD: av = avma; p1 = (GEN)x[1]; p2 = gmul((GEN)p1[2], gsqr((GEN)x[3])); p1 = gcmp0((GEN)p1[3])? gsqr((GEN)x[2]) : gmul((GEN)x[2], gadd((GEN)x[2],(GEN)x[3])); return gerepileupto(av, gadd(p1,p2)); case t_POL: case t_SER: case t_RFRAC: av = avma; return gerepileupto(av, greal(gmul(gconj(x),x))); case t_POLMOD: { GEN T = (GEN)x[1], A = (GEN)x[2]; if (typ(A) != t_POL) return gpowgs(A, degpol(T)); y = subres(T, A); p1 = leading_term(T); if (gcmp1(p1) || gcmp0(A)) return y; av = avma; T = gpowgs(p1, degpol(A)); return gerepileupto(av, gdiv(y,T)); } case t_VEC: case t_COL: case t_MAT: lx=lg(x); y=cgetg(lx,tx); for (i=1; i<lx; i++) y[i]=lnorm((GEN) x[i]); return y; } err(typeer,"gnorm"); return NULL; /* not reached */} |
mymyrand() | mymyrand(void) | mymyrand(){#if BITS_IN_RANDOM == 64 pari_randseed = (1000000000000654397*pari_randseed + 12347) & ~HIGHBIT;#else pari_randseed = (1000276549*pari_randseed + 12347) & 0x7fffffff;#endif return pari_randseed;} |
norme1 = (GEN)norms[ per[i-1] ]; | smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; int stockall = (stockmax < 0); if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); av = avma; lim = stack_lim(av,2); if (stockall) stockmax = 200; if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { GEN dummy = cgetg(1, t_STR); int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) S = clonefill(S, s, stockmax); if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1 = avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1, eps); borne2 = mpmul(borne1, alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { /* overflow */ GEN per, Sold = S; pari_sp av2; if (!check) goto END; if (stockall) { stockmax *= 2; S = cgetg(stockmax+1, t_VEC); } av2 = avma; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)Sold[k])) { if (!j) borne1 = mpadd(norme1,eps); S[++j] = Sold[k]; } } s = j; avma = av2; if (s) { if (isclone(Sold)) { S = clonefill(S, s, stockmax); gunclone(Sold); } norme1 = (GEN)norms[ per[i-1] ]; norms = cgetg(stockmax+1, t_VEC); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = mpadd(norme1, eps); borne2 = mpmul(borne1, alpha); checkcnt = 0; } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;} |
|
const unsigned32 *base, *ebase; unsigned32 length; | const uint32_t *base, *ebase; uint32_t length; | void *Stack_check_find_high_water_mark( const void *s, size_t n){ const unsigned32 *base, *ebase; unsigned32 length; base = s; length = n/4;#if ( CPU_STACK_GROWS_UP == TRUE ) /* * start at higher memory and find first word that does not * match pattern */ base += length - 1; for (ebase = s; base > ebase; base--) if (*base != U32_PATTERN) return (void *) base;#else /* * start at lower memory and find first word that does not * match pattern */ base += PATTERN_SIZE_WORDS; for (ebase = base + length; base < ebase; base++) if (*base != U32_PATTERN) return (void *) base;#endif return (void *)0;} |
unsigned32 size, used; | uint32_t size, used; | void Stack_check_Dump_threads_usage( Thread_Control *the_thread){ unsigned32 size, used; void *low; void *high_water_mark; Stack_Control *stack; unsigned32 u32_name; char name_str[5]; char *name; Objects_Information *info; if ( !the_thread ) return; /* * XXX HACK to get to interrupt stack */ if (the_thread == (Thread_Control *) -1) { if (stack_check_interrupt_stack.area) { stack = &stack_check_interrupt_stack; the_thread = 0; } else return; } else stack = &the_thread->Start.Initial_stack; low = Stack_check_usable_stack_start(stack); size = Stack_check_usable_stack_size(stack); high_water_mark = Stack_check_find_high_water_mark(low, size); if ( high_water_mark ) used = Stack_check_Calculate_used( low, size, high_water_mark ); else used = 0; name = name_str; if ( the_thread ) { info = _Objects_Get_information(the_thread->Object.id); if ( info->is_string ) { name = (char *) the_thread->Object.name; } else { u32_name = (unsigned32)the_thread->Object.name; name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } } else { u32_name = rtems_build_name('I', 'N', 'T', 'R'); name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } printf( "0x%08x %4s 0x%08x 0x%08x %8d %8d\n", the_thread ? the_thread->Object.id : ~0, name, (unsigned32) stack->area, (unsigned32) stack->area + (unsigned32) stack->size - 1, size, used );} |
unsigned32 u32_name; | uint32_t u32_name; | void Stack_check_Dump_threads_usage( Thread_Control *the_thread){ unsigned32 size, used; void *low; void *high_water_mark; Stack_Control *stack; unsigned32 u32_name; char name_str[5]; char *name; Objects_Information *info; if ( !the_thread ) return; /* * XXX HACK to get to interrupt stack */ if (the_thread == (Thread_Control *) -1) { if (stack_check_interrupt_stack.area) { stack = &stack_check_interrupt_stack; the_thread = 0; } else return; } else stack = &the_thread->Start.Initial_stack; low = Stack_check_usable_stack_start(stack); size = Stack_check_usable_stack_size(stack); high_water_mark = Stack_check_find_high_water_mark(low, size); if ( high_water_mark ) used = Stack_check_Calculate_used( low, size, high_water_mark ); else used = 0; name = name_str; if ( the_thread ) { info = _Objects_Get_information(the_thread->Object.id); if ( info->is_string ) { name = (char *) the_thread->Object.name; } else { u32_name = (unsigned32)the_thread->Object.name; name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } } else { u32_name = rtems_build_name('I', 'N', 'T', 'R'); name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } printf( "0x%08x %4s 0x%08x 0x%08x %8d %8d\n", the_thread ? the_thread->Object.id : ~0, name, (unsigned32) stack->area, (unsigned32) stack->area + (unsigned32) stack->size - 1, size, used );} |
u32_name = (unsigned32)the_thread->Object.name; | u32_name = (uint32_t )the_thread->Object.name; | void Stack_check_Dump_threads_usage( Thread_Control *the_thread){ unsigned32 size, used; void *low; void *high_water_mark; Stack_Control *stack; unsigned32 u32_name; char name_str[5]; char *name; Objects_Information *info; if ( !the_thread ) return; /* * XXX HACK to get to interrupt stack */ if (the_thread == (Thread_Control *) -1) { if (stack_check_interrupt_stack.area) { stack = &stack_check_interrupt_stack; the_thread = 0; } else return; } else stack = &the_thread->Start.Initial_stack; low = Stack_check_usable_stack_start(stack); size = Stack_check_usable_stack_size(stack); high_water_mark = Stack_check_find_high_water_mark(low, size); if ( high_water_mark ) used = Stack_check_Calculate_used( low, size, high_water_mark ); else used = 0; name = name_str; if ( the_thread ) { info = _Objects_Get_information(the_thread->Object.id); if ( info->is_string ) { name = (char *) the_thread->Object.name; } else { u32_name = (unsigned32)the_thread->Object.name; name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } } else { u32_name = rtems_build_name('I', 'N', 'T', 'R'); name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } printf( "0x%08x %4s 0x%08x 0x%08x %8d %8d\n", the_thread ? the_thread->Object.id : ~0, name, (unsigned32) stack->area, (unsigned32) stack->area + (unsigned32) stack->size - 1, size, used );} |
(unsigned32) stack->area, (unsigned32) stack->area + (unsigned32) stack->size - 1, | (uint32_t ) stack->area, (uint32_t ) stack->area + (uint32_t ) stack->size - 1, | void Stack_check_Dump_threads_usage( Thread_Control *the_thread){ unsigned32 size, used; void *low; void *high_water_mark; Stack_Control *stack; unsigned32 u32_name; char name_str[5]; char *name; Objects_Information *info; if ( !the_thread ) return; /* * XXX HACK to get to interrupt stack */ if (the_thread == (Thread_Control *) -1) { if (stack_check_interrupt_stack.area) { stack = &stack_check_interrupt_stack; the_thread = 0; } else return; } else stack = &the_thread->Start.Initial_stack; low = Stack_check_usable_stack_start(stack); size = Stack_check_usable_stack_size(stack); high_water_mark = Stack_check_find_high_water_mark(low, size); if ( high_water_mark ) used = Stack_check_Calculate_used( low, size, high_water_mark ); else used = 0; name = name_str; if ( the_thread ) { info = _Objects_Get_information(the_thread->Object.id); if ( info->is_string ) { name = (char *) the_thread->Object.name; } else { u32_name = (unsigned32)the_thread->Object.name; name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } } else { u32_name = rtems_build_name('I', 'N', 'T', 'R'); name[ 0 ] = (u32_name >> 24) & 0xff; name[ 1 ] = (u32_name >> 16) & 0xff; name[ 2 ] = (u32_name >> 8) & 0xff; name[ 3 ] = (u32_name >> 0) & 0xff; name[ 4 ] = '\0'; } printf( "0x%08x %4s 0x%08x 0x%08x %8d %8d\n", the_thread ? the_thread->Object.id : ~0, name, (unsigned32) stack->area, (unsigned32) stack->area + (unsigned32) stack->size - 1, size, used );} |
unsigned32 length = 0; | uint32_t length = 0; | rtems_monitor_queue_dump( rtems_monitor_queue_t *monitor_queue, boolean verbose){ unsigned32 length = 0; length += rtems_monitor_dump_id(monitor_queue->id); length += rtems_monitor_pad(11, length); length += rtems_monitor_dump_name(monitor_queue->name); length += rtems_monitor_pad(19, length); length += rtems_monitor_dump_attributes(monitor_queue->attributes); length += rtems_monitor_pad(31, length); length += rtems_monitor_dump_decimal(monitor_queue->number_of_pending_messages); length += rtems_monitor_pad(39, length); length += rtems_monitor_dump_decimal(monitor_queue->maximum_pending_messages); length += rtems_monitor_pad(48, length); length += rtems_monitor_dump_decimal(monitor_queue->maximum_message_size); printf("\n");} |
eval_pol(GEN nf,GEN pol,GEN alpha,GEN algebre,GEN algebre1) | eval_pol(GEN nf,GEN pol,GEN alpha,GEN algebre,GEN algebre1, GEN p) | eval_pol(GEN nf,GEN pol,GEN alpha,GEN algebre,GEN algebre1){ gpmem_t av=avma,tetpil; long i,kbar,k, lx = lgef(pol)-1, N = degpol(nf[1]); GEN res; kbar = lg(algebre1)-1; k = N-kbar; res = gscalcol_i((GEN)pol[lx], N); for (i=2; i<lx; i++) { res = element_mul(nf,alpha,res); res[1] = ladd((GEN)res[1],(GEN)pol[i]); } res = project(algebre,res,k,kbar); tetpil=avma; return gerepile(av,tetpil,gmul(algebre1,res));} |
gpmem_t av=avma,tetpil; | gpmem_t av=avma; | eval_pol(GEN nf,GEN pol,GEN alpha,GEN algebre,GEN algebre1){ gpmem_t av=avma,tetpil; long i,kbar,k, lx = lgef(pol)-1, N = degpol(nf[1]); GEN res; kbar = lg(algebre1)-1; k = N-kbar; res = gscalcol_i((GEN)pol[lx], N); for (i=2; i<lx; i++) { res = element_mul(nf,alpha,res); res[1] = ladd((GEN)res[1],(GEN)pol[i]); } res = project(algebre,res,k,kbar); tetpil=avma; return gerepile(av,tetpil,gmul(algebre1,res));} |
res = project(algebre,res,k,kbar); tetpil=avma; return gerepile(av,tetpil,gmul(algebre1,res)); | res = project(algebre,res,k,kbar,p); return gerepileupto(av, FpV_red(gmul(algebre1,res), p)); | eval_pol(GEN nf,GEN pol,GEN alpha,GEN algebre,GEN algebre1){ gpmem_t av=avma,tetpil; long i,kbar,k, lx = lgef(pol)-1, N = degpol(nf[1]); GEN res; kbar = lg(algebre1)-1; k = N-kbar; res = gscalcol_i((GEN)pol[lx], N); for (i=2; i<lx; i++) { res = element_mul(nf,alpha,res); res[1] = ladd((GEN)res[1],(GEN)pol[i]); } res = project(algebre,res,k,kbar); tetpil=avma; return gerepile(av,tetpil,gmul(algebre1,res));} |
} | rtems_monitor_task( rtems_task_argument monitor_flags){ rtems_tcb *debugee = 0; rtems_context *rp; rtems_context_fp *fp; char command_buffer[513]; int argc; char *argv[64]; boolean verbose = FALSE; if (monitor_flags & RTEMS_MONITOR_SUSPEND) (void) rtems_monitor_suspend(RTEMS_NO_TIMEOUT); for (;;) { extern rtems_tcb * _Thread_Executing; rtems_monitor_command_entry_t *command; debugee = _Thread_Executing; rp = &debugee->Registers; fp = (rtems_context_fp *) debugee->fp_context; /* possibly 0 */ if (0 == rtems_monitor_command_read(command_buffer, &argc, argv)) continue; if ((command = rtems_monitor_command_lookup(rtems_monitor_commands, argc, argv)) == 0) continue; command->command_function(argc, argv, command->command_arg, verbose); fflush(stdout); }} |
|
rtems_unsigned32 n = rtems_get_index(*next_id); | uint32_t n = rtems_get_index(*next_id); | rtems_monitor_symbol_next( void *object_info, rtems_monitor_symbol_t *canonical, rtems_id *next_id){ rtems_symbol_table_t *table; rtems_unsigned32 n = rtems_get_index(*next_id); table = *(rtems_symbol_table_t **) object_info; if (table == 0) goto failed; if (n >= table->next) goto failed; /* NOTE: symbols do not have id and name fields */ if (table->sorted == 0) rtems_symbol_sort(table); _Thread_Disable_dispatch(); *next_id += 1; return (void *) (table->addresses + n);failed: *next_id = RTEMS_OBJECT_ID_FINAL; return 0;} |
unsigned32 default_node, | uint32_t default_node, | rtems_monitor_id_fixup( rtems_id id, unsigned32 default_node, rtems_monitor_object_type_t type){ unsigned32 node; node = rtems_get_node(id); if (node == 0) { if (rtems_get_class(id) != OBJECTS_NO_CLASS) type = rtems_get_class(id); id = _Objects_Build_id( OBJECTS_CLASSIC_API, type, default_node, rtems_get_index(id)); } return id;} |
unsigned32 node; | uint32_t node; | rtems_monitor_id_fixup( rtems_id id, unsigned32 default_node, rtems_monitor_object_type_t type){ unsigned32 node; node = rtems_get_node(id); if (node == 0) { if (rtems_get_class(id) != OBJECTS_NO_CLASS) type = rtems_get_class(id); id = _Objects_Build_id( OBJECTS_CLASSIC_API, type, default_node, rtems_get_index(id)); } return id;} |
if (resid < 0 || so->so_type == SOCK_STREAM && (flags & MSG_EOR)) { | if ((resid < 0) || (so->so_type == SOCK_STREAM && (flags & MSG_EOR))) { | sosend(so, addr, uio, top, control, flags) register struct socket *so; struct mbuf *addr; struct uio *uio; struct mbuf *top; struct mbuf *control; int flags;{ struct mbuf **mp; register struct mbuf *m; register long space, len, resid; int clen = 0, error, s, dontroute, mlen; int atomic = sosendallatonce(so) || top; if (uio) resid = uio->uio_resid; else resid = top->m_pkthdr.len; /* * In theory resid should be unsigned. * However, space must be signed, as it might be less than 0 * if we over-committed, and we must use a signed comparison * of space and resid. On the other hand, a negative resid * causes us to loop sending 0-length segments to the protocol. * * Also check to make sure that MSG_EOR isn't used on SOCK_STREAM * type sockets since that's an error. */ if (resid < 0 || so->so_type == SOCK_STREAM && (flags & MSG_EOR)) { error = EINVAL; goto out; } dontroute = (flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 && (so->so_proto->pr_flags & PR_ATOMIC); if (control) clen = control->m_len;#define snderr(errno) { error = errno; splx(s); goto release; }restart: error = sblock(&so->so_snd, SBLOCKWAIT(flags)); if (error) goto out; do { s = splnet(); if (so->so_state & SS_CANTSENDMORE) snderr(EPIPE); if (so->so_error) { error = so->so_error; so->so_error = 0; splx(s); goto release; } if ((so->so_state & SS_ISCONNECTED) == 0) { /* * `sendto' and `sendmsg' is allowed on a connection- * based socket if it supports implied connect. * Return ENOTCONN if not connected and no address is * supplied. */ if ((so->so_proto->pr_flags & PR_CONNREQUIRED) && (so->so_proto->pr_flags & PR_IMPLOPCL) == 0) { if ((so->so_state & SS_ISCONFIRMING) == 0 && !(resid == 0 && clen != 0)) snderr(ENOTCONN); } else if (addr == 0) snderr(so->so_proto->pr_flags & PR_CONNREQUIRED ? ENOTCONN : EDESTADDRREQ); } space = sbspace(&so->so_snd); if (flags & MSG_OOB) space += 1024; if ((atomic && resid > so->so_snd.sb_hiwat) || clen > so->so_snd.sb_hiwat) snderr(EMSGSIZE); if (space < resid + clen && uio && (atomic || space < so->so_snd.sb_lowat || space < clen)) { if (so->so_state & SS_NBIO) snderr(EWOULDBLOCK); sbunlock(&so->so_snd); error = sbwait(&so->so_snd); splx(s); if (error) goto out; goto restart; } splx(s); mp = ⊤ space -= clen; do { if (uio == NULL) { /* * Data is prepackaged in "top". */ resid = 0; if (flags & MSG_EOR) top->m_flags |= M_EOR; } else do { if (top == 0) { MGETHDR(m, M_WAIT, MT_DATA); mlen = MHLEN; m->m_pkthdr.len = 0; m->m_pkthdr.rcvif = (struct ifnet *)0; } else { MGET(m, M_WAIT, MT_DATA); mlen = MLEN; } if (resid >= MINCLSIZE) { MCLGET(m, M_WAIT); if ((m->m_flags & M_EXT) == 0) goto nopages; mlen = MCLBYTES; len = min(min(mlen, resid), space); } else {nopages: len = min(min(mlen, resid), space); /* * For datagram protocols, leave room * for protocol headers in first mbuf. */ if (atomic && top == 0 && len < mlen) MH_ALIGN(m, len); } space -= len; error = uiomove(mtod(m, caddr_t), (int)len, uio); resid = uio->uio_resid; m->m_len = len; *mp = m; top->m_pkthdr.len += len; if (error) goto release; mp = &m->m_next; if (resid <= 0) { if (flags & MSG_EOR) top->m_flags |= M_EOR; break; } } while (space > 0 && atomic); if (dontroute) so->so_options |= SO_DONTROUTE; s = splnet(); /* XXX */ error = (*so->so_proto->pr_usrreqs->pru_send)(so, (flags & MSG_OOB) ? PRUS_OOB : /* * If the user set MSG_EOF, the protocol * understands this flag and nothing left to * send then use PRU_SEND_EOF instead of PRU_SEND. */ ((flags & MSG_EOF) && (so->so_proto->pr_flags & PR_IMPLOPCL) && (resid <= 0)) ? PRUS_EOF : 0, top, addr, control); splx(s); if (dontroute) so->so_options &= ~SO_DONTROUTE; clen = 0; control = 0; top = 0; mp = ⊤ if (error) goto release; } while (resid && space > 0); } while (resid);release: sbunlock(&so->so_snd);out: if (top) m_freem(top); if (control) m_freem(control); return (error);} |
term_width_intern() | term_width_intern(void) | term_width_intern(){#ifdef HAS_TIOCGWINSZ { struct winsize s; if (!under_emacs && !under_texmacs && !ioctl(0, TIOCGWINSZ, &s)) return s.ws_col; }#endif#ifdef UNIX { char *str; if ((str = getenv("COLUMNS"))) return atoi(str); }#endif#ifdef __EMX__ { int scrsize[2]; _scrsize(scrsize); return scrsize[0]; }#endif return 0;} |
&& ((ntohs (tp->pkbuf.tftpACK.blocknum) == 0) || (ntohs (tp->pkbuf.tftpACK.blocknum) == 1))) { | && (ntohs (tp->pkbuf.tftpACK.blocknum) == 0)) { | static int rtems_tftp_open_worker( rtems_libio_t *iop, char *full_path_name, unsigned32 flags, unsigned32 mode){ struct tftpStream *tp; int retryCount; struct in_addr farAddress; int s; int len; char *cp1; char *cp2; char *remoteFilename; rtems_interval now; rtems_status_code sc; char *hostname; /* * Extract the host name component */ cp2 = full_path_name; while (*cp2 == '/') cp2++; hostname = cp2; while (*cp2 != '/') { if (*cp2 == '\0') return ENOENT; cp2++; } *cp2++ = '\0'; /* * Convert hostname to Internet address */ if (strcmp (hostname, "BOOTP_HOST") == 0) farAddress = rtems_bsdnet_bootp_server_address; else farAddress.s_addr = inet_addr (hostname); if ((farAddress.s_addr == 0) || (farAddress.s_addr == ~0)) return ENOENT; /* * Extract file pathname component */ while (*cp2 == '/') cp2++; if (strcmp (cp2, "BOOTP_FILE") == 0) { cp2 = rtems_bsdnet_bootp_boot_file_name; while (*cp2 == '/') cp2++; } if (*cp2 == '\0') return ENOENT; remoteFilename = cp2; if (strlen (remoteFilename) > (TFTP_BUFSIZE - 10)) return ENOENT; /* * Find a free stream */ sc = rtems_semaphore_obtain (tftp_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); if (sc != RTEMS_SUCCESSFUL) return EBUSY; for (s = 0 ; s < nStreams ; s++) { if (tftpStreams[s] == NULL) break; } if (s == nStreams) { /* * Reallocate stream pointers * Guard against the case where realloc() returns NULL. */ struct tftpStream **np; np = realloc (tftpStreams, ++nStreams * sizeof *tftpStreams); if (np == NULL) { rtems_semaphore_release (tftp_mutex); return ENOMEM; } tftpStreams = np; } tp = tftpStreams[s] = malloc (sizeof (struct tftpStream)); rtems_semaphore_release (tftp_mutex); if (tp == NULL) return ENOMEM; iop->data0 = s; iop->data1 = tp; /* * Create the socket */ if ((tp->socket = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { releaseStream (s); return ENOMEM; } /* * Bind the socket to a local address */ retryCount = 0; rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now); for (;;) { int try = (now + retryCount) % 10; tp->myAddress.sin_family = AF_INET; tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + s); tp->myAddress.sin_addr.s_addr = htonl (INADDR_ANY); if (bind (tp->socket, (struct sockaddr *)&tp->myAddress, sizeof tp->myAddress) >= 0) break; if (++retryCount == 10) { close (tp->socket); releaseStream (s); return EBUSY; } } /* * Set the UDP destination to the TFTP server * port on the remote machine. */ tp->farAddress.sin_family = AF_INET; tp->farAddress.sin_addr = farAddress; tp->farAddress.sin_port = htons (69); /* * Start the transfer */ tp->firstReply = 1; retryCount = 0; for (;;) { /* * Create the request */ if ((flags & O_ACCMODE) == O_RDONLY) { tp->writing = 0; tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_RRQ); } else { tp->writing = 1; tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_WRQ); } cp1 = (char *) tp->pkbuf.tftpRWRQ.filename_mode; cp2 = (char *) remoteFilename; while ((*cp1++ = *cp2++) != '\0') continue; cp2 = "octet"; while ((*cp1++ = *cp2++) != '\0') continue; len = cp1 - (char *)&tp->pkbuf.tftpRWRQ; /* * Send the request */ if (sendto (tp->socket, (char *)&tp->pkbuf, len, 0, (struct sockaddr *)&tp->farAddress, sizeof tp->farAddress) < 0) { close (tp->socket); releaseStream (s); return EIO; } /* * Get reply */ len = getPacket (tp, retryCount); if (len >= (int) sizeof tp->pkbuf.tftpACK) { int opcode = ntohs (tp->pkbuf.tftpDATA.opcode); if (!tp->writing && (opcode == TFTP_OPCODE_DATA) && (ntohs (tp->pkbuf.tftpDATA.blocknum) == 1)) { tp->nused = 0; tp->blocknum = 1; tp->nleft = len - 2 * sizeof (rtems_unsigned16); tp->eof = (tp->nleft < TFTP_BUFSIZE); if (sendAck (tp) != 0) { close (tp->socket); releaseStream (s); return EIO; } break; } if (tp->writing && (opcode == TFTP_OPCODE_ACK) && ((ntohs (tp->pkbuf.tftpACK.blocknum) == 0) || (ntohs (tp->pkbuf.tftpACK.blocknum) == 1))) { tp->nused = 0; tp->blocknum = ntohs (tp->pkbuf.tftpACK.blocknum); break; } if (opcode == TFTP_OPCODE_ERROR) { int e = tftpErrno (tp); close (tp->socket); releaseStream (s); return e; } } /* * Keep trying */ if (++retryCount >= OPEN_RETRY_LIMIT) { close (tp->socket); releaseStream (s); return EIO; } } return 0;} |
tp->blocknum = ntohs (tp->pkbuf.tftpACK.blocknum); | tp->blocknum = 1; | static int rtems_tftp_open_worker( rtems_libio_t *iop, char *full_path_name, unsigned32 flags, unsigned32 mode){ struct tftpStream *tp; int retryCount; struct in_addr farAddress; int s; int len; char *cp1; char *cp2; char *remoteFilename; rtems_interval now; rtems_status_code sc; char *hostname; /* * Extract the host name component */ cp2 = full_path_name; while (*cp2 == '/') cp2++; hostname = cp2; while (*cp2 != '/') { if (*cp2 == '\0') return ENOENT; cp2++; } *cp2++ = '\0'; /* * Convert hostname to Internet address */ if (strcmp (hostname, "BOOTP_HOST") == 0) farAddress = rtems_bsdnet_bootp_server_address; else farAddress.s_addr = inet_addr (hostname); if ((farAddress.s_addr == 0) || (farAddress.s_addr == ~0)) return ENOENT; /* * Extract file pathname component */ while (*cp2 == '/') cp2++; if (strcmp (cp2, "BOOTP_FILE") == 0) { cp2 = rtems_bsdnet_bootp_boot_file_name; while (*cp2 == '/') cp2++; } if (*cp2 == '\0') return ENOENT; remoteFilename = cp2; if (strlen (remoteFilename) > (TFTP_BUFSIZE - 10)) return ENOENT; /* * Find a free stream */ sc = rtems_semaphore_obtain (tftp_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); if (sc != RTEMS_SUCCESSFUL) return EBUSY; for (s = 0 ; s < nStreams ; s++) { if (tftpStreams[s] == NULL) break; } if (s == nStreams) { /* * Reallocate stream pointers * Guard against the case where realloc() returns NULL. */ struct tftpStream **np; np = realloc (tftpStreams, ++nStreams * sizeof *tftpStreams); if (np == NULL) { rtems_semaphore_release (tftp_mutex); return ENOMEM; } tftpStreams = np; } tp = tftpStreams[s] = malloc (sizeof (struct tftpStream)); rtems_semaphore_release (tftp_mutex); if (tp == NULL) return ENOMEM; iop->data0 = s; iop->data1 = tp; /* * Create the socket */ if ((tp->socket = socket (AF_INET, SOCK_DGRAM, 0)) < 0) { releaseStream (s); return ENOMEM; } /* * Bind the socket to a local address */ retryCount = 0; rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now); for (;;) { int try = (now + retryCount) % 10; tp->myAddress.sin_family = AF_INET; tp->myAddress.sin_port = htons (UDP_PORT_BASE + nStreams * try + s); tp->myAddress.sin_addr.s_addr = htonl (INADDR_ANY); if (bind (tp->socket, (struct sockaddr *)&tp->myAddress, sizeof tp->myAddress) >= 0) break; if (++retryCount == 10) { close (tp->socket); releaseStream (s); return EBUSY; } } /* * Set the UDP destination to the TFTP server * port on the remote machine. */ tp->farAddress.sin_family = AF_INET; tp->farAddress.sin_addr = farAddress; tp->farAddress.sin_port = htons (69); /* * Start the transfer */ tp->firstReply = 1; retryCount = 0; for (;;) { /* * Create the request */ if ((flags & O_ACCMODE) == O_RDONLY) { tp->writing = 0; tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_RRQ); } else { tp->writing = 1; tp->pkbuf.tftpRWRQ.opcode = htons (TFTP_OPCODE_WRQ); } cp1 = (char *) tp->pkbuf.tftpRWRQ.filename_mode; cp2 = (char *) remoteFilename; while ((*cp1++ = *cp2++) != '\0') continue; cp2 = "octet"; while ((*cp1++ = *cp2++) != '\0') continue; len = cp1 - (char *)&tp->pkbuf.tftpRWRQ; /* * Send the request */ if (sendto (tp->socket, (char *)&tp->pkbuf, len, 0, (struct sockaddr *)&tp->farAddress, sizeof tp->farAddress) < 0) { close (tp->socket); releaseStream (s); return EIO; } /* * Get reply */ len = getPacket (tp, retryCount); if (len >= (int) sizeof tp->pkbuf.tftpACK) { int opcode = ntohs (tp->pkbuf.tftpDATA.opcode); if (!tp->writing && (opcode == TFTP_OPCODE_DATA) && (ntohs (tp->pkbuf.tftpDATA.blocknum) == 1)) { tp->nused = 0; tp->blocknum = 1; tp->nleft = len - 2 * sizeof (rtems_unsigned16); tp->eof = (tp->nleft < TFTP_BUFSIZE); if (sendAck (tp) != 0) { close (tp->socket); releaseStream (s); return EIO; } break; } if (tp->writing && (opcode == TFTP_OPCODE_ACK) && ((ntohs (tp->pkbuf.tftpACK.blocknum) == 0) || (ntohs (tp->pkbuf.tftpACK.blocknum) == 1))) { tp->nused = 0; tp->blocknum = ntohs (tp->pkbuf.tftpACK.blocknum); break; } if (opcode == TFTP_OPCODE_ERROR) { int e = tftpErrno (tp); close (tp->socket); releaseStream (s); return e; } } /* * Keep trying */ if (++retryCount >= OPEN_RETRY_LIMIT) { close (tp->socket); releaseStream (s); return EIO; } } return 0;} |
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == (tp->blocknum + 1))) { | && (ntohs (tp->pkbuf.tftpACK.blocknum) == tp->blocknum)) { | static int rtems_tftp_flush ( struct tftpStream *tp ){ int wlen, rlen; int retryCount = 0; wlen = tp->nused + 2 * sizeof (rtems_unsigned16); for (;;) { tp->pkbuf.tftpDATA.opcode = htons (TFTP_OPCODE_DATA); tp->pkbuf.tftpDATA.blocknum = htons (tp->blocknum);#ifdef RTEMS_TFTP_DRIVER_DEBUG if (rtems_tftp_driver_debug) printf ("TFTP: SEND %d (%d)\n", tp->blocknum, tp->nused);#endif if (sendto (tp->socket, (char *)&tp->pkbuf, wlen, 0, (struct sockaddr *)&tp->farAddress, sizeof tp->farAddress) < 0) return EIO; rlen = getPacket (tp, retryCount); /* * Our last packet won't necessarily be acknowledged! */ if ((rlen < 0) && (tp->nused < sizeof tp->pkbuf.tftpDATA.data)) return 0; if (rlen >= (int)sizeof tp->pkbuf.tftpACK) { int opcode = ntohs (tp->pkbuf.tftpACK.opcode); if ((opcode == TFTP_OPCODE_ACK) && (ntohs (tp->pkbuf.tftpACK.blocknum) == (tp->blocknum + 1))) { tp->nused = 0; tp->blocknum++; return 0; } if (opcode == TFTP_OPCODE_ERROR) return tftpErrno (tp); } /* * Keep trying? */ if (++retryCount == IO_RETRY_LIMIT) return EIO; }} |
} | case t_QFI:case t_QFR: break; default: err(typeer,"division"); } | gdiv(GEN x, GEN y){ long tx = typ(x), ty = typ(y), lx,ly,vx,vy,i,j,k,l,av,tetpil; GEN z,p1,p2,p3; if (y == gun) return gcopy(x); if (tx==t_INT && is_const_t(ty)) { switch (signe(x)) { case 0: if (gcmp0(y)) err(gdiver2); if (ty != t_INTMOD) return gzero; z = cgetg(3,t_INTMOD); icopyifstack(y[1],z[1]); z[2]=zero; return z; case 1: if (is_pm1(x)) return ginv(y); break; case -1: if (is_pm1(x)) { av = avma; return gerepileupto(av, ginv(gneg(y))); } } switch(ty) { case t_INT: av=avma; z=dvmdii(x,y,&p1); if (p1==gzero) return z; (void)new_chunk((lgefint(x) + lgefint(y)) << 2); p1 = mppgcd(y,p1); avma=av; z=cgetg(3,t_FRAC); if (is_pm1(p1)) { z[1]=licopy(x); z[2]=licopy(y); } else { z[1]=ldivii(x,p1); z[2]=ldivii(y,p1); } fix_frac(z); return z; case t_REAL: return divir(x,y); case t_INTMOD: z=cgetg(3,t_INTMOD); p2=(GEN)y[1]; (void)new_chunk(lgefint(p2)<<2); p1=mulii(modii(x,p2), mpinvmod((GEN)y[2],p2)); avma=(long)z; z[2]=lmodii(p1,p2); icopyifstack(p2,z[1]); return z; case t_FRAC: z=cgetg(3,t_FRAC); p1 = mppgcd(x,(GEN)y[1]); if (is_pm1(p1)) { avma = (long)z; tetpil = 0; z[2] = licopy((GEN)y[1]); } else { x = divii(x,p1); tetpil = avma; z[2] = ldivii((GEN)y[1], p1); } z[1] = lmulii((GEN)y[2], x); fix_frac(z); if (tetpil) { fix_frac_if_int_GC(z,tetpil); } else fix_frac_if_int(z); return z; case t_FRACN: z=cgetg(3,t_FRACN); z[1]=lmulii((GEN)y[2], x); z[2]=licopy((GEN)y[1]); fix_frac(z); return z; case t_PADIC: l=avma; p1=cgetp(y); gaffect(x,p1); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,y)); case t_COMPLEX: case t_QUAD: l=avma; p1=gnorm(y); p2=gmul(x,gconj(y)); tetpil=avma; return gerepile(l,tetpil,gdiv(p2,p1)); } } if (gcmp0(y)) err(gdiver2); if (is_const_t(tx) && is_const_t(ty)) { switch(tx) { case t_REAL: switch(ty) { case t_INT: return divri(x,y); case t_REAL: return divrr(x,y); case t_FRAC: case t_FRACN: l=avma; p1=cgetg(lg(x),t_REAL); gaffect(y,p1); return gerepile(l,(long)p1,divrr(x,p1)); case t_COMPLEX: z=cgetg(3,t_COMPLEX); l=avma; p1=gnorm(y); p2=gmul(x,(GEN)y[1]); p3=gmul(x,(GEN)y[2]); if (!gcmp0(p3)) p3 = gneg_i(p3); tetpil=avma; z[1]=ldiv(p2,p1); z[2]=ldiv(p3,p1); gerepilemanyvec(l,tetpil,z+1,2); return z; case t_QUAD: l=avma; p1=co8(y,lg(x)); tetpil=avma; return gerepile(l,tetpil,gdiv(x,p1)); case t_INTMOD: case t_PADIC: err(gdiverf,tx,ty); } case t_INTMOD: switch(ty) { case t_INT: z=cgetg(3,t_INTMOD); p2=(GEN)x[1]; (void)new_chunk(lgefint(p2)<<2); p1=mulii((GEN)x[2], mpinvmod(y,p2)); avma=(long)z; z[2]=lmodii(p1,p2); icopyifstack(p2,z[1]); return z; case t_INTMOD: z=cgetg(3,t_INTMOD); p2=(GEN)x[1]; p1=(GEN)y[1]; if (p1==p2 || egalii(p1,p2)) { icopyifstack(p2,z[1]); } else { p2 = mppgcd(p1,p2); z[1] = (long)p2; } av=avma; (void)new_chunk(lgefint(x[1]) + (lgefint(p1) << 1)); p1=mulii((GEN)x[2], mpinvmod((GEN)y[2],p2)); avma=av; z[2]=lmodii(p1,p2); return z; case t_FRAC: z=cgetg(3,t_INTMOD); p2=(GEN)x[1]; (void)new_chunk(lgefint(p2)<<2); p1=mulii((GEN)y[2], mpinvmod((GEN)y[1],p2)); p1=mulii(modii(p1,p2),(GEN)x[2]); avma=(long)z; z[2]=lmodii(p1,p2); icopyifstack(p2,z[1]); return z; case t_FRACN: l=avma; p1=gred(y); tetpil=avma; return gerepile(l,tetpil,gdiv(x,p1)); case t_COMPLEX: case t_QUAD: l=avma; p1=gnorm(y); p2=gmul(x,gconj(y)); tetpil=avma; return gerepile(l,tetpil,gdiv(p2,p1)); case t_PADIC: l=avma; p1=cgetg(3,t_INTMOD); p1[1]=x[1]; p1[2]=lgeti(lg(x[1])); gaffect(y,p1); tetpil=avma; return gerepile(l,tetpil,gdiv(x,p1)); case t_REAL: err(gdiverf,tx,ty); } case t_FRAC: case t_FRACN: switch(ty) { case t_INT: z = cgetg(3, tx); if (tx == t_FRAC) { p1 = mppgcd(y,(GEN)x[1]); if (is_pm1(p1)) { avma = (long)z; tetpil = 0; z[1] = licopy((GEN)x[1]); } else { y = divii(y,p1); tetpil = avma; z[1] = ldivii((GEN)x[1], p1); } } else { tetpil = 0; z[1] = licopy((GEN)x[1]); } z[2] = lmulii((GEN)x[2],y); fix_frac(z); if (tetpil) fix_frac_if_int_GC(z,tetpil); return z; case t_REAL: l=avma; p1=cgetg(lg(y),t_REAL); gaffect(x,p1); p2=divrr(p1,y); return gerepile(l,(long)p1,p2); case t_INTMOD: z=cgetg(3,t_INTMOD); p2=(GEN)y[1]; (void)new_chunk(lgefint(p2)<<2); p1=mulii((GEN)y[2],(GEN)x[2]); p1=mulii(mpinvmod(p1,p2), modii((GEN)x[1],p2)); avma=(long)z; z[2]=lmodii(p1,p2); icopyifstack(p2,z[1]); return z; case t_FRAC: if (tx == t_FRACN) ty=t_FRACN; case t_FRACN: z = cgetg(3,ty); if (ty == t_FRAC) { GEN x1 = (GEN)x[1], x2 = (GEN)x[2]; GEN y1 = (GEN)y[1], y2 = (GEN)y[2]; p1 = mppgcd(x1, y1); if (!is_pm1(p1)) { x1 = divii(x1,p1); y1 = divii(y1,p1); } p1 = mppgcd(x2, y2); if (!is_pm1(p1)) { x2 = divii(x2,p1); y2 = divii(y2,p1); } tetpil = avma; z[2] = lmulii(x2,y1); z[1] = lmulii(x1,y2); fix_frac(z); fix_frac_if_int_GC(z,tetpil); } else { z[1]=lmulii((GEN)x[1],(GEN)y[2]); z[2]=lmulii((GEN)x[2],(GEN)y[1]); fix_frac(z); } return z; case t_COMPLEX: z=cgetg(3,t_COMPLEX); l=avma; p1=gnorm(y); p2=gmul(x,(GEN)y[1]); p3=gmul(x,(GEN)y[2]); if(!gcmp0(p3)) p3 = gneg_i(p3); tetpil=avma; z[1]=ldiv(p2,p1); z[2]=ldiv(p3,p1); gerepilemanyvec(l,tetpil,z+1,2); return z; case t_PADIC: if (!signe(x[1])) return gzero; l=avma; p1=cgetp(y); gaffect(x,p1); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,y)); case t_QUAD: l=avma; p1=gnorm(y); p2=gmul(x,gconj(y)); tetpil=avma; return gerepile(l,tetpil,gdiv(p2,p1)); } case t_COMPLEX: switch(ty) { case t_INT: case t_REAL: case t_INTMOD: case t_FRAC: case t_FRACN: z=cgetg(3,t_COMPLEX); z[1]=ldiv((GEN)x[1],y); z[2]=ldiv((GEN)x[2],y); return z; case t_COMPLEX: l=avma; p1=gnorm(y); p2=gconj(y); p2=gmul(x,p2); tetpil=avma; return gerepile(l,tetpil, gdiv(p2,p1)); case t_PADIC: if (krosg(-1,(GEN)y[2])== -1) { z=cgetg(3,t_COMPLEX); z[1]=ldiv((GEN)x[1],y); z[2]=ldiv((GEN)x[2],y); return z; } av=avma; p1=cvtop(x,(GEN)y[2],precp(y)); tetpil=avma; return gerepile(av,tetpil,gdiv(p1,y)); case t_QUAD: lx=precision(x); if (!lx) err(gdiveri,tx,ty); l=avma; p1=co8(y,lx); tetpil=avma; return gerepile(l,tetpil,gdiv(x,p1)); } case t_PADIC: switch(ty) { case t_INT: case t_FRAC: case t_FRACN: l=avma; if (signe(x[4])) { p1=cgetp(x); gaffect(y,p1); } else p1=cvtop(y,(GEN)x[2],(valp(x)>0)?valp(x):1); tetpil=avma; return gerepile(l,tetpil,gdiv(x,p1)); case t_INTMOD: l=avma; p1=cgetg(3,t_INTMOD); p1[1]=y[1]; p1[2]=lgeti(lg(y[1])); gaffect(x,p1); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,y)); case t_PADIC: if (!egalii((GEN)x[2],(GEN)y[2])) err(gdiveri,tx,ty); if (!signe(x[4])) { z=gcopy(x); setvalp(z,valp(x)-valp(y)); return z; } p1=(precp(x)>precp(y)) ? y : x; z=cgetp(p1); l=avma; setvalp(z,valp(x)-valp(y)); p2=mpinvmod((GEN)y[4],(GEN)p1[3]); modiiz(mulii((GEN)x[4],p2),(GEN)p1[3],(GEN)z[4]); avma=l; return z; case t_COMPLEX: case t_QUAD: l=avma; p1=gmul(x,gconj(y)); p2=gnorm(y); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,p2)); case t_REAL: err(talker,"forbidden division p-adic/R"); } case t_QUAD: switch (ty) { case t_INT: case t_INTMOD: case t_FRAC: case t_FRACN: z=cgetg(4,t_QUAD); copyifstack(x[1], z[1]); for (i=2; i<4; i++) z[i]=ldiv((GEN)x[i],y); return z; case t_REAL: l=avma; p1=co8(x,lg(y)); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,y)); case t_PADIC: l=avma; p1=cvtop(x,(GEN)y[2],precp(y)); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,y)); case t_COMPLEX: ly=precision(y); if (!ly) err(gdiveri,tx,ty); l=avma; p1=co8(x,ly); tetpil=avma; return gerepile(l,tetpil,gdiv(p1,y)); case t_QUAD: k=x[1]; l=y[1]; if (!gegal((GEN)k,(GEN)l)) err(gdiveri,tx,ty); l=avma; p1=gnorm(y); p2=gmul(x,gconj(y)); tetpil=avma; return gerepile(l,tetpil,gdiv(p2,p1)); } } err(bugparier,"division"); } vx=gvar(x); vy=gvar(y); if (ty==t_POLMOD && (tx==t_POLMOD || vy<vx)) { z=cgetg(3,t_POLMOD); if (tx==t_POLMOD) { k=x[1]; l=y[1]; if (gegal((GEN)k,(GEN)l)) { copyifstack(k, z[1]); av=avma; p1 = ginvmod((GEN)y[2],(GEN)z[1]); p2 = gmul((GEN)x[2],p1); } else { vx=varn(x[1]); vy=varn(y[1]); if (vx==vy) { z[1]=lgcd((GEN)k,(GEN)l); av=avma; p1=ginvmod((GEN)y[2],(GEN)z[1]); p2=gmul((GEN)x[2],p1); } else { if (vx<vy) { copyifstack(k,z[1]); av=avma; p2=gdiv((GEN)x[2],y); } else { copyifstack(l,z[1]); av=avma; p1 = ginvmod((GEN)y[2],(GEN)z[1]); p2 = gmul(x, p1); } } } p2 = gmod(p2,(GEN)z[1]); } else { copyifstack(y[1],z[1]); av=avma; p1 = ginvmod((GEN)y[2],(GEN)y[1]); p2 = gmul(x,p1); } z[2]=lpileupto(av, p2); return z; } if (tx == t_POLMOD && vx<vy) { z=cgetg(3,t_POLMOD); copyifstack(x[1],z[1]); z[2]=ldiv((GEN)x[2],y); return z; } if (vx == vy) { av = avma; if (tx == t_POLMOD) return gerepileupto(av, gdiv(x, to_polmod(y,(GEN)x[1]))); if (ty == t_POLMOD) return gerepileupto(av, gdiv(to_polmod(x,(GEN)y[1]), y)); } /* now x and y are not both is_scalar_t */ lx = lg(x); if ((vx<vy && (!is_matvec_t(tx) || !is_matvec_t(ty))) || (vx==vy && is_scalar_t(ty)) || (is_matvec_t(tx) && !is_matvec_t(ty))) { if (tx == t_RFRAC) return divrfracscal(x,y); z = cgetg(lx,tx); if (tx == t_RFRACN) { z[2]=lmul((GEN)x[2],y); z[1]=lcopy((GEN)x[1]); return z; } switch(tx) { case t_POL: lx = lgef(x); case t_SER: z[1] = x[1]; case t_VEC: case t_COL: case t_MAT: if (ty == t_POLMOD || ty == t_INTMOD) { if (!gcmp1(y)) y = ginv(y); /* garbage, left alone */ for (i=lontyp[tx]; i<lx; i++) z[i]=lmul((GEN)x[i],y); return z; } else for (i=lontyp[tx]; i<lx; i++) z[i]=ldiv((GEN)x[i],y); return z; } err(typeer,"division"); } ly=lg(y); if (vy<vx || (vy==vx && is_scalar_t(tx))) { switch(ty) { case t_POL: if (lgef(y)==3) return gdiv(x,(GEN)y[2]); if (isexactzero(x)) return zeropol(vy); av=avma; z=cgetg(3,t_RFRAC); z[1]=(long)x; z[2]=(long)y; return gerepileupto(av,gred_rfrac(z)); case t_SER: if (gcmp0(x)) { l=avma; p1=ginv(y); tetpil=avma; /* a ameliorer !!!! */ return gerepile(l,tetpil,gmul(x,p1)); } p1 = (GEN)gpmalloc(ly*sizeof(long)); p1[0] = evaltyp(t_SER) | evallg(ly); p1[1] = evalsigne(1) | evalvalp(0) | evalvarn(vy); p1[2] = (long)x; for (i=3; i<ly; i++) p1[i]=zero; y = gdiv(p1,y); free(p1); return y; case t_RFRAC: return divscalrfrac(x,y); case t_RFRACN: z=cgetg(ly,t_RFRACN); z[1]=lmul(x,(GEN)y[2]); z[2]=lcopy((GEN)y[1]); return z; case t_MAT: if (ly==1 || lg(y[1])!=ly) err(gdiveri,tx,ty); l=avma; p1=invmat(y); tetpil=avma; return gerepile(l,tetpil,gmul(x,p1)); case t_VEC: case t_COL: err(gdiverf,tx,ty); } err(typeer,"division"); } /* ici vx=vy et tx>=10 et ty>=10*/ switch(tx) { case t_POL: switch(ty) { case t_POL: if (lgef(y)==3) return gdiv(x,(GEN)y[2]); if (isexactzero(x)) return zeropol(vy); av=avma; z=cgetg(3,t_RFRAC); z[1]=(long)x; z[2]=(long)y; return gerepileupto(av,gred_rfrac(z)); case t_SER: if (gcmp0(x)) return zeropol(vx); p1=greffe(x,ly,0); p2=gdiv(p1,y); free(p1); return p2; case t_RFRAC: return divscalrfrac(x,y); case t_RFRACN: z=cgetg(ly,t_RFRACN); z[1]=lmul(x,(GEN)y[2]); z[2]=lcopy((GEN)y[1]); return z; case t_VEC: case t_COL: case t_MAT: err(gdiverf,tx,ty); default: err(typeer,"division"); } case t_SER: switch(ty) { case t_POL: p1=greffe(y,lx,0); p2=gdiv(x,p1); free(p1); return p2; case t_SER: { GEN y_lead; l = valp(x) - valp(y); if (gcmp0(x)) return zeroser(vx,l); y_lead = (GEN)y[2]; if (gcmp0(y_lead)) /* normalize denominator if leading term is 0 */ { err(warner,"normalizing a series with 0 leading term"); for (i=3,y++; i<ly; i++,y++) { y_lead = (GEN)y[2]; ly--; l--; if (!gcmp0(y_lead)) break; } if (i==ly) err(gdiver2); } if (ly < lx) lx = ly; p2 = (GEN)gpmalloc(lx*sizeof(long)); for (i=3; i<lx; i++) { p1 = (GEN)y[i]; if (isexactzero(p1)) p2[i] = 0; else { av = avma; p2[i] = lclone(gneg_i(p1)); avma = av; } } z = cgetg(lx,t_SER); z[1] = evalvalp(l) | evalvarn(vx) | evalsigne(1); z[2] = ldiv((GEN)x[2], y_lead); for (i=3; i<lx; i++) { av=avma; p1 = (GEN)x[i]; for (j=2; j<i; j++) { l = i-j+2; if (p2[l]) p1 = gadd(p1, gmul((GEN)z[j], (GEN)p2[l])); } tetpil=avma; z[i]=lpile(av,tetpil, gdiv(p1,y_lead)); } for (i=3; i<lx; i++) if (p2[i]) gunclone((GEN)p2[i]); free(p2); return z; } case t_RFRAC: case t_RFRACN: l=avma; p2=gmul(x,(GEN)y[2]); tetpil=avma; return gerepile(l,tetpil,gdiv(p2,(GEN)y[1])); case t_VEC: case t_COL: case t_MAT: err(gdiverf,tx,ty); default: err(typeer,"division"); } case t_RFRAC: case t_RFRACN: switch(ty) { case t_POL: if (tx==t_RFRAC) return divrfracscal(x,y); z=cgetg(3,t_RFRACN); z[2]=lmul((GEN)x[2],y); z[1]=lcopy((GEN)x[1]); return z; case t_SER: l=avma; p2=gmul((GEN)x[2],y); tetpil=avma; return gerepile(l,tetpil, gdiv((GEN)x[1],p2)); case t_RFRAC: case t_RFRACN: if (tx == t_RFRACN) ty=t_RFRACN; if (ty != t_RFRACN) return divrfrac(x,y); z=cgetg(3,t_RFRACN); z[1]=lmul((GEN)x[1],(GEN)y[2]); z[2]=lmul((GEN)x[2],(GEN)y[1]); return z; case t_VEC: case t_COL: case t_MAT: err(gdiverf,tx,ty); default: err(typeer,"division"); } case t_VEC: case t_COL: case t_MAT: if (!is_matvec_t(ty)) { z=cgetg(lx,tx); for (i=1; i<lx; i++) z[i]=ldiv((GEN)x[i],y); return z; } if (ty!=t_MAT || ly==1 || lg(y[1])!=ly) err(gdiveri,tx,ty); l=avma; p1=invmat(y); tetpil=avma; return gerepile(l,tetpil,gmul(x,p1)); } if (tx==ty) { l=signe(y[2]); setsigne(y[2],-l); switch(tx) { case t_QFI: z = compimag(x,y); setsigne(y[2],l); return z; case t_QFR: k=signe(y[4]); setsigne(y[4],-k); z=compreal(x,y); setsigne(y[2],l); setsigne(y[4],k); return z; } } err(typeer,"division"); return NULL; /* not reached */} |
(Objects_Name) 0, | (rtems_name) 0, | void _Region_MP_Send_extract_proxy ( Thread_Control *the_thread){ _Region_MP_Send_process_packet( REGION_MP_EXTRACT_PROXY, the_thread->Wait.id, (Objects_Name) 0, the_thread->Object.id );} |