ホーム 道しるべ 憩いの広場 濃緑空間 濃緑研の日記

Round2に挑戦
ホーム ] 上へ ] 概説 ] 固定小数点 除算 ] FixedPoint Tool ] [ Round2に挑戦 ]

 

エントリルーチン

Round2への参戦コードです。
ここに示すのは演算部のみです。(演算はimulとaddしか使っていません)

void r2fixed(long lcoeff[SZOUTVECTOR][SZINVECTOR], long lin_vector[SZINVECTOR], long lout_vector[SZOUTVECTOR], int count )
{
                _asm {
                    push     eax
                   
                    mov         ecx,count
                    mov         edi,lin_vector

loop_count_x86_fixed:                             // loop count times
                    push     ecx
                    mov         ecx,SZOUTVECTOR
                    mov         eax,lout_vector
                    mov         ebx,lcoeff

loop_raw_x86_fixed:
                    push     ecx
                    push     eax

                    mov         eax,[edi]
                    imul     DWORD PTR [ebx]
                    mov         ecx,edx

                    mov         eax,[edi+4]
                    imul     DWORD PTR [ebx+4]
                    add         ecx,edx

                    mov         eax,[edi+8]
                    imul     DWORD PTR [ebx+8]
                    add         ecx,edx

                    mov         eax,[edi+12]
                    imul     DWORD PTR [ebx+12]
                    add         ecx,edx

                    mov         eax,[edi+16]
                    imul     DWORD PTR [ebx+16]
                    add         ecx,edx

                    mov         eax,[edi+20]
                    imul     DWORD PTR [ebx+20]
                    add         ecx,edx

                    mov         eax,[edi+24]
                    imul     DWORD PTR [ebx+24]
                    add         ecx,edx

                    mov         eax,[edi+28]
                    imul     DWORD PTR [ebx+28]
                    add         ecx,edx

                    mov         eax,[edi+32]
                    imul     DWORD PTR [ebx+32]
                    add         ecx,edx

                    mov         eax,[edi+36]
                    imul     DWORD PTR [ebx+36]
                    add         ecx,edx

                    mov         eax,[edi+40]
                    imul     DWORD PTR [ebx+40]
                    add         ecx,edx

                    mov         eax,[edi+44]
                    imul     DWORD PTR [ebx+44]
                    add         ecx,edx

                    mov         eax,[edi+48]
                    imul     DWORD PTR [ebx+48]
                    add         ecx,edx

                    mov         eax,[edi+52]
                    imul     DWORD PTR [ebx+52]
                    add         ecx,edx

                    mov         eax,[edi+56]
                    imul     DWORD PTR [ebx+56]
                    add         ecx,edx

                    mov         eax,[edi+60]
                    imul     DWORD PTR [ebx+60]
                    add         ecx,edx

                    mov         eax,[edi+64]
                    imul     DWORD PTR [ebx+64]
                    add         ecx,edx

                    mov         eax,[edi+68]
                    imul     DWORD PTR [ebx+68]
                    add         ecx,edx

                    mov         eax,[edi+72]
                    imul     DWORD PTR [ebx+72]
                    add         ecx,edx

                    mov         eax,[edi+76]
                    imul     DWORD PTR [ebx+76]
                    add         ecx,edx

                    mov         eax,[edi+80]
                    imul     DWORD PTR [ebx+80]
                    add         ecx,edx

                    mov         eax,[edi+84]
                    imul     DWORD PTR [ebx+84]
                    add         ecx,edx

                    mov         eax,[edi+88]
                    imul     DWORD PTR [ebx+88]
                    add         ecx,edx

                    mov         eax,[edi+92]
                    imul     DWORD PTR [ebx+92]
                    add         ecx,edx

                    mov         eax,[edi+96]
                    imul     DWORD PTR [ebx+96]
                    add         ecx,edx

                    mov         eax,[edi+100]
                    imul     DWORD PTR [ebx+100]
                    add         ecx,edx

                    mov         eax,[edi+104]
                    imul     DWORD PTR [ebx+104]
                    add         ecx,edx

                    mov         eax,[edi+108]
                    imul     DWORD PTR [ebx+108]
                    add         ecx,edx

                    mov         eax,[edi+112]
                    imul     DWORD PTR [ebx+112]
                    add         ecx,edx

                    mov         eax,[edi+116]
                    imul     DWORD PTR [ebx+116]
                    add         ecx,edx

                    mov         eax,[edi+120]
                    imul     DWORD PTR [ebx+120]
                    add         ecx,edx

                    mov         eax,[edi+124]
                    imul     DWORD PTR [ebx+124]
                    add         ecx,edx

                    mov         eax,[edi+128]
                    imul     DWORD PTR [ebx+128]
                    add         ecx,edx

                    mov         eax,[edi+132]
                    imul     DWORD PTR [ebx+132]
                    add         ecx,edx

                    mov         eax,[edi+136]
                    imul     DWORD PTR [ebx+136]
                    add         ecx,edx

                    mov         eax,[edi+140]
                    imul     DWORD PTR [ebx+140]
                    add         ecx,edx

                    pop         eax
                    mov         [eax],ecx
                    add         eax,4
                   
                    add         ebx,144
                    pop         ecx
                    dec         ecx
                    jnz         loop_raw_x86_fixed

                    pop         ecx
                    dec         ecx
                    jnz         loop_count_x86_fixed
                       
                    pop         eax
                }
}