Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

u jelly?

Name: Anonymous 2010-11-26 19:32


    //ai = radians/(2ã) (or ratio of angle step around full circle)
    //for(i=0;i<num;i++) { costabptr[i] = cos((double)i*ai*PI*2); sintabptr[i] = sin((double)i*ai*PI*2); }
static _inline void dcalccossinasm (double *costabptr, double *sintabptr, long num, double ai)
{
        //Excellent precision: Based on FFT.C/WAVY.C/FCALCSIN.BAS; rewritten to do both cos&sin in same loop
        //Using C wouldn't be too slow, but with ASM, I can ensure all temp calculations are in 80-bit regs :)
        //double c, s, ci, si, m; long i;
        //ai *= PI*2;
        //c = 1; ci = cos(ai)-1;
        //s = 0; si = sin(ai);
        //m = ci+ci;
        //for(i=0;i<num;i++)
        //{  costabptr[i] = c; c += ci; ci += c*m;
        //   sintabptr[i] = s; s += si; si += s*m;
        //}
    _asm
    {
        fldpi                   ;ã
        fmul qword ptr ai       ;ai*ã
        fadd st, st             ;ai*ã*2
        fsincos                 ;cos(ai*ã) sin(ai*ã)
        fld1                    ;1 cos(ai*ã) sin(ai*ã)
        fsubp st(1), st         ;ci si
        fld st(0)               ;ci ci si
        fadd st, st             ;m ci si
        fldz                    ;s m ci si
        fld1                    ;c s m ci si
        mov eax, num
        mov edx, sintabptr
        mov ecx, costabptr
        shl eax, 3
        add edx, eax
        add ecx, eax
        neg eax
 beg: fst qword ptr [eax+ecx] ;c s m ci si
        fadd st, st(3)          ;c+ci s m ci si
        fld st(2)               ;m c+ci s m ci si
        fmul st, st(1)          ;m*(c+ci) c+ci s m ci si
        faddp st(4), st         ;c+ci s m ci+m*(c+ci) si
        fxch st(1)              ;s c+ci m ci+m*(c+ci) si
        fst qword ptr [eax+edx] ;s c m ci si
        fadd st, st(4)          ;s+si c m ci si
        fld st(2)               ;m s+si c m ci si
        fmul st, st(1)          ;m*(s+si) s+si c m ci si
        faddp st(5), st         ;s+si c m ci si+m*(s+si)
        fxch st(1)              ;c s+si m ci si+m*(s+si)
        add eax, 8
        jnz short beg
        fucompp                 ;m ci si+m*(s+si)
        fucompp                 ;si+m*(s+si)
        fstp st                 ;
    }
}

Name: Anonymous 2010-11-26 19:33

i gelatinous

Name: Anonymous 2010-11-26 19:44

How can i be jelly that doesnt even makesense (im an human bieng)

Name: Anonymous 2010-11-26 20:16

I, however, am a human being.

I am also jealous. I've never been able to master ASM, that stuff is just not obvious to me.

Name: Anonymous 2010-11-26 20:31

curls for the girls

Name: Anonymous 2010-11-26 21:34

I cannot find a good tutorial for asm....

sad....

Name: Anonymous 2010-11-26 21:38

Neverthless, i implicitly make sense in the jealously if humankind does however

Name: Anonymous 2011-02-03 5:24

Name: Anonymous 2011-02-04 15:44

Name: Anonymous 2011-02-18 13:48

<-- that's cool and all, but check 'em

Don't change these.
Name: Email:
Entire Thread Thread List