Test eax eax5/27/2023 ![]() ![]() convert mov edx, _sinto : mov cl, mov, cl inc edx inc edi test cl, cl jnz dec edi ret.convert :call u2tret convert unsigned 32BIT number to textu2t :cmp eax, 9 0-9? single digit? ja convert fast and return add eax, 30h mov, ax '#', 0 inc edi :mov esi, edi save startmov ecx, 1999999Ah : mov ebx, eax n/10. convert mov byte, '-' inc edi neg eax cmp eax, - 2147483648 signed minimum? jne. after, edi=end/0 (for s/print/f)reverse.digits :push edidec : mov cl, exchange edi/esi mov ch, mov, ch mov, cl dec edi inc esi cmp esi, edi until middlejb ediret convert signed 32BIT integer to texti2t :test eax, 80000000h negative? jz. t2i text to signed 32BIT integer t2u text to unsigned 32BIT integer t2h text to 32BIT hexadecimal number t2b text to 32BIT binary number _sinto : db '2147483648', 0_digits : db '0123456789ABCDEFGHIJKLMNOPQRSTUV' reverse number. ![]() i2t signed 32BIT integer to text u2t unsigned 32BIT integer to text h2t 32BIT hexadecimal number to text b2t 32BIT binary number to text convert text (ESI) to number (EAX). Replaced with shifts and multiply by reciprocal CONVERT.INC convert number (EAX) to text (EDI). Alters all registers, caller/function must preserve * Optimized: Single digits 0-9 are converted fast. Code: Fast Text/Number Conversions: DEC/HEX/BIN * 100% ASM, fast-call, standalone.
0 Comments
Leave a Reply. |