我对汇编语言实在是没辙,如下:
SWORD get_svalue(BYTE k) // k>0 always // Takes k bits out of the BIT stream (wordval), and makes them a signed value { _asm { xor ecx, ecx mov cl,k mov eax,[wordval] shl eax,cl shr eax, 16 dec cl bt eax,ecx jc end_macro signed_value:inc cl mov ebx,[start_neg_pow2] add ax,word ptr [ebx+ecx*2] end_macro: } }
WORD WORD_hi_lo(BYTE byte_high,BYTE byte_low) { _asm { mov ah,byte_high mov al,byte_low } }
WORD lookKbits(BYTE k) { _asm { mov dl, k mov cl, 16 sub cl, dl mov eax, [wordval] shr eax, cl } }
请高手帮我把上述3个函数用C语言实现,急用,谢谢! |