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

Fixed to Float
ホーム ] 上へ ] Float to Fixed ] Normalize ] [ Fixed to Float ] Adjust Point ] 座標変換に挑戦 ]

 


ただ変換できればいいという、稚拙なロジックです。


lf2f(long s, long p, float* d)
{
    unsigned char    count;
    float             temp;
    long             lw;

    p = p + 125;
    count = p;
    lw = abs(s);

    _asm {
        mov         bl,count
        mov         eax,lw
        shl         eax,1
        shl         eax,1

        shr         ebx,1
        rcr         eax,1

        shr         ebx,1
        rcr         eax,1

        shr         ebx,1
        rcr         eax,1

        shr         ebx,1
        rcr         eax,1

        shr         ebx,1
        rcr         eax,1

        shr         ebx,1
        rcr         eax,1

        shr         ebx,1
        rcr         eax,1

        shr         ebx,1
        rcr         eax,1

        mov         ecx,s
        add         ecx,0
        jns         step1
        stc
    step1:
        rcr         eax,1
        mov         temp,eax
    }
    *d = temp;
}