AMD 250 Computer Hardware User Manual


 
Chapter 8 Integer Optimizations 185
Software Optimization Guide for AMD64 Processors
25112 Rev. 3.06 September 2005
or eax, '0' ; Convert digit to ASCII.
mov [edi], al ; Store digit in memory.
lea eax, [edx*4+edx] ; 5 * fraction, new digit EAX[31-21]
lea edx, [edx*4+edx] ; 5 * fraction, new fraction EDX[21-0]
cmp ebx, 1 ; Any nonzero digit yet?
sbb edi, -1 ; Yes, increment ptr. No, keep old ptr.
shr eax, 21 ; Next digit
and edx, 001fffffh ; Fraction part
or ebx, eax ; Accumulate next digit.
or eax, '0' ; Convert digit to ASCII.
mov [edi], al ; Store digit in memory.
lea eax, [edx*4+edx] ; 5 * fraction, new digit EAX[31-20]
cmp ebx, 1 ; Any nonzero digit yet?
sbb edi, -1 ; Yes, increment ptr. No, keep old ptr.
shr eax, 20 ; Next digit
or eax, '0' ; Convert digit to ASCII.
mov [edi], ax ; Store last digit and end marker in memory.
pop ebx ; Restore register as per calling convention.
pop edi ; Restore register as per calling convention.
ret 8 ; Pop two DWORD arguments and return.
}
}