float to fixed point f2lf(float s,long* d,long* p) { long temp; unsigned char count; _asm { mov eax,s shl eax,1 mov ebx,eax mov cl,24 shr ebx,cl mov count,bl mov cl,8 shl eax,cl stc rcr eax,1 shr eax,1 mov temp,eax } *p = count-125; *d = temp; if (s<0) *d = -temp; }fixed point to float 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; }
文章標籤
全站熱搜
創作者介紹
創作者 soarlin 的頭像
soarlin

每天都有新鮮事

soarlin 發表在 痞客邦 留言(0) 人氣(1,875)