Answer the question
In order to leave comments, you need to log in
How to change the function code in assembler?
Hello. There is this function:
function sar32(value, shift: longint): longint;
asm
mov ecx, edx
sar eax, cl
end;
function sar32(value: Int64; shift: longint): longint;
Answer the question
In order to leave comments, you need to log in
In this case, the variable value is passed through the stack and needs to be put into registers, and shift flies into the eax register. So the code will be like this:
function sar64(value: Int64; shift: LongInt): LongInt;
asm
mov ecx, eax
mov eax, dword ptr [value]
mov edx, dword ptr [value+4]
shrd eax, edx, cl
end;
how to change this function so that it converts the result to Integer and not LongInt
function sar32(value: Int64; shift: longint): longint;
asm
shrd eax, edx, cl
end;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question