From: io_x on 13 Dec 2009 15:50 Do you like my functions for find "numeri creditori" and "numeri debitori"? Do you find i'm sloppy for not think on the return value of "ZeroFree"? First two are written in assembly (in the way exist is one to one corrispondence) the last is a subset of C++ that is more near to C ------------ ; char* __stdcall MemCat_m(char* des, char* ori, int nc) ; ritorna la posizione a cui e' arrivato nel vettore di char "des" ; s=0j, 4i, 8b, 12ra, 16Ades, 20Aori, 24Anc align 4 MemCat_m: <b,i,j j=[s+16]|b=[s+20]|i=[s+24] i==0#.2 |j==0#.2 ..1: al=*b|*j=al|++b,j|--i#.1 ..2: a=j ..cf: >b,i,j ret 12 ; -1 cf==1 per errore ; 0 cf==0 tutto ok ; 0ra, 4P align 4 ZeroFree: a=^4|a==0#.f GetSize(a)|jnc .1 ..e: a=-1|stc|#.z ..1: r=^4|Zero(r, a) a=^4|Free_m(a)|jc .e ..f: a^=a ..z: ret 4 ---------- #define F for #define P printf #define R return #define G goto // ritorna 0 errore 1 tutto ok int DaiNumeri(fnum* nDeb, fnum* nCred, u32 nConto, Data inizio, Data fine, Conto0* filiale, FILE_m* FileStriscieP, FILE_m* FileStriscieOldP, FILE_m* FilePuntatoriStriscieP, FILE_m* FileSaldiP) {i32 n_elx[2], r, r0, r1, k, n_el, j, delta; u32 dovefile; i8 **pi, *p, *p1, *elencox[2], *elenco; Data dataP; fnum saldo, t; if(nDeb==0||nCred==0||filiale==0) R 0; *nDeb=0; *nCred=0; if(inizio>fine||(fine-inizio)>365) R 0; if(fine.anno<200) R 0; r0=StriscieContoAnno(&elencox[0], &n_elx[0], nConto, fine.anno-1, filiale, FileStriscieP, FileStriscieOldP, FilePuntatoriStriscieP); if(r0==0) R 0; r1=StriscieContoAnno(&elencox[1], &n_elx[1], nConto, fine.anno, filiale, FileStriscieP, FileStriscieOldP, FilePuntatoriStriscieP); if(r1==0){l0:; ZeroFree(elencox[0]); R 0;} r0=n_elx[0]; if(r0< 0){l1:; ZeroFree(elencox[1]); G l0;} r1=n_elx[1]; if(r1< 0) G l1; r=r0+r1; if(r < 0) G l1; if(r+2<0) G l1; if((k=(r+2)*sizeof(Striscia))<0) G l1; p=(char*)Malloc_m(k); if(p==0) G l1; p1=MemCat_m(p, elencox[0], r0*sizeof(Striscia)); MemCat_m(p1, elencox[1], r1*sizeof(Striscia)); elenco=p; n_el=r; ZeroFree(elencox[0]); ZeroFree(elencox[1]); pi= (i8**) Malloc_m((n_el+8)*sizeof(i8*)); if(pi==0){l2:; ZeroFree(elenco); R 0;} F(j=0; j<n_el; ++j) pi[j]=elenco+j*sizeof(Striscia); if(qsortPnt_m(pi, n_el, comparaStrisciaValuta)==0) {l3:; ZeroFree(pi); G l2;} r=SaldoInData(&saldo, &dovefile, nConto, (inizio-1), filiale, FileStriscieP, FileStriscieOldP, FilePuntatoriStriscieP, FileSaldiP); if(r==-1) G l3; cout << "Saldo iniziale in data " << (inizio-1) << " : "; StampaSaldo(stdout_m, saldo, globalPrecision); P("\n"); F(j=0, dataP=(inizio-1); j<n_el; ++j) {Striscia *s1; fnum v; s1=(Striscia*)pi[j]; if(s1->DataValuta> fine) break; if(s1->DataValuta>=inizio) {if( DaCifraAfnum(&t, s1->imp)==0) G l3; delta=(s1->DataValuta)-dataP; dataP=(s1->DataValuta); v=saldo*delta; if(saldo>=0) *nCred+=v; else *nDeb -=v; cout << v << " "; saldo=saldo+t; } else if(s1->DataOperazione>=inizio) {if( DaCifraAfnum(&t, s1->imp)==0) G l3; saldo=saldo+t; cout << saldo << "s "; } } ZeroFree(pi); ZeroFree(elenco); R 1; } -------------------------------- the result is something like Numero Debitore: 0.00000000000000000000F Numero Creditore: 387475.35000000000000000110F+ i have to say that 20 cicle of the loop "F(j=0, dataP=(inizio-1); j<n_el; ++j)" make one error of 0.00000000000000000110F+
From: Esra Sdrawkcab on 14 Dec 2009 04:52 On Sun, 13 Dec 2009 20:50:54 -0000, io_x <a(a)b.c.invalid> wrote: > Do you like my functions for find "numeri creditori" and "numeri > debitori"? > Do you find i'm sloppy for not think on the return value of "ZeroFree"? > > First two are written in assembly (in the way exist is one to one > corrispondence) > the last is a subset of C++ that is more near to C > > ------------ > ; char* __stdcall MemCat_m(char* des, char* ori, int nc) > ; ritorna la posizione a cui e' arrivato nel vettore di char "des" > ; s=0j, 4i, 8b, 12ra, 16Ades, 20Aori, 24Anc > align 4 > MemCat_m: > <b,i,j > j=[s+16]|b=[s+20]|i=[s+24] > i==0#.2 |j==0#.2 > .1: al=*b|*j=al|++b,j|--i#.1 > .2: a=j > .cf: >> b,i,j > ret 12 > > ; -1 cf==1 per errore > ; 0 cf==0 tutto ok > ; 0ra, 4P > align 4 > ZeroFree: > a=^4|a==0#.f > GetSize(a)|jnc .1 > .e: a=-1|stc|#.z > .1: r=^4|Zero(r, a) > a=^4|Free_m(a)|jc .e > .f: a^=a > .z: > ret 4 > ---------- > > #define F for > #define P printf > #define R return > #define G goto > > // ritorna 0 errore 1 tutto ok > int DaiNumeri(fnum* nDeb, fnum* nCred, u32 nConto, > Data inizio, Data fine, Conto0* filiale, > FILE_m* FileStriscieP, FILE_m* FileStriscieOldP, > FILE_m* FilePuntatoriStriscieP, FILE_m* FileSaldiP) > {i32 n_elx[2], r, r0, r1, k, n_el, j, delta; > u32 dovefile; > i8 **pi, *p, *p1, *elencox[2], *elenco; > Data dataP; > fnum saldo, t; > > if(nDeb==0||nCred==0||filiale==0) R 0; > *nDeb=0; *nCred=0; > if(inizio>fine||(fine-inizio)>365) R 0; > if(fine.anno<200) R 0; > r0=StriscieContoAnno(&elencox[0], &n_elx[0], nConto, fine.anno-1, > filiale, FileStriscieP, FileStriscieOldP, FilePuntatoriStriscieP); > if(r0==0) R 0; > r1=StriscieContoAnno(&elencox[1], &n_elx[1], nConto, fine.anno, > filiale, FileStriscieP, FileStriscieOldP, FilePuntatoriStriscieP); > if(r1==0){l0:; ZeroFree(elencox[0]); R 0;} > r0=n_elx[0]; if(r0< 0){l1:; ZeroFree(elencox[1]); G l0;} > r1=n_elx[1]; if(r1< 0) G l1; > r=r0+r1; if(r < 0) G l1; if(r+2<0) G l1; > if((k=(r+2)*sizeof(Striscia))<0) G l1; > p=(char*)Malloc_m(k); if(p==0) G l1; > p1=MemCat_m(p, elencox[0], r0*sizeof(Striscia)); > MemCat_m(p1, elencox[1], r1*sizeof(Striscia)); > elenco=p; n_el=r; > ZeroFree(elencox[0]); ZeroFree(elencox[1]); > pi= (i8**) Malloc_m((n_el+8)*sizeof(i8*)); > if(pi==0){l2:; ZeroFree(elenco); R 0;} > F(j=0; j<n_el; ++j) > pi[j]=elenco+j*sizeof(Striscia); > if(qsortPnt_m(pi, n_el, comparaStrisciaValuta)==0) > {l3:; ZeroFree(pi); G l2;} > > r=SaldoInData(&saldo, &dovefile, nConto, (inizio-1), > filiale, FileStriscieP, FileStriscieOldP, > FilePuntatoriStriscieP, FileSaldiP); > if(r==-1) G l3; > cout << "Saldo iniziale in data " << (inizio-1) << " : "; > StampaSaldo(stdout_m, saldo, globalPrecision); > P("\n"); > F(j=0, dataP=(inizio-1); j<n_el; ++j) > {Striscia *s1; > fnum v; > s1=(Striscia*)pi[j]; > if(s1->DataValuta> fine) break; > if(s1->DataValuta>=inizio) > {if( DaCifraAfnum(&t, s1->imp)==0) G l3; > delta=(s1->DataValuta)-dataP; > dataP=(s1->DataValuta); > v=saldo*delta; > if(saldo>=0) *nCred+=v; > else *nDeb -=v; > cout << v << " "; > saldo=saldo+t; > } > else if(s1->DataOperazione>=inizio) > {if( DaCifraAfnum(&t, s1->imp)==0) G l3; > saldo=saldo+t; > cout << saldo << "s "; > } > } > ZeroFree(pi); ZeroFree(elenco); > R 1; > } > -------------------------------- > the result is something like > Numero Debitore: 0.00000000000000000000F > Numero Creditore: 387475.35000000000000000110F+ > > i have to say that 20 cicle of the loop > "F(j=0, dataP=(inizio-1); j<n_el; ++j)" > make one error of 0.00000000000000000110F+ > > It doesn't help that I don't know Italian, but more off-putting is the strange assembler syntax. PS why not define 'if' as I? It all smacks of BASIC programming where single letter variables were all you had. -- Nuns! Reverse!
From: io_x on 15 Dec 2009 03:32 "Esra Sdrawkcab" <admin(a)127.0.0.1> ha scritto nel messaggio news:op.u4w9pllrhswpfo(a)dell3100... > On Sun, 13 Dec 2009 20:50:54 -0000, io_x <a(a)b.c.invalid> wrote: > It doesn't help that I don't know Italian, but more off-putting is the > strange assembler syntax. "MemCat_m:" and "ZeroFree:" are address of function written in something near to assembly (save in some way the (1 subset of symbols) to (1 cpu instruction)) int DaiNumeri(etc) is a C++ function > PS why not define 'if' as I? in the C/C++ environment, yes good idea I(a<32) G label; but don't know if "I" is reserved for complex number representation > It all smacks of BASIC programming where single letter variables were all you > had. the error of the first basic programs are in the absence of indentation the same now for the "raw assembly" > -- > Nuns! Reverse!
From: Nathan on 17 Dec 2009 13:41 On Dec 14, 4:52 am, "Esra Sdrawkcab" <ad...(a)127.0.0.1> wrote: > > It doesn't help that I don't know Italian, but more off-putting is the > strange assembler syntax. > It is an esoteric asm language. Perhaps it is best described as an 'obfuscated' asm language? Nathan.
From: io_x on 17 Dec 2009 15:41 "Nathan" <nathancbaker(a)gmail.com> ha scritto nel messaggio news:aa554226-ea19-4c07-89bf-3a57b62fcf3a(a)f20g2000vbl.googlegroups.com... On Dec 14, 4:52 am, "Esra Sdrawkcab" <ad...(a)127.0.0.1> wrote: > > It doesn't help that I don't know Italian, but more off-putting is the > strange assembler syntax. > It is an esoteric asm language. Perhaps it is best described as an 'obfuscated' asm language? Nathan. it is 'obfuscated' for you like some code people write could be 'obfuscated' for me things are easy but people find many way to complicate them
|
Next
|
Last
Pages: 1 2 Prev: HOT NEWS FOR EVERYONE!!! Next: peter-bochs debugger released 20091214 version |