hex2str: Perform test r9,r9 only once (instead of for each number in loop .convert)

This commit is contained in:
2025-07-10 00:22:36 +02:00
parent 7d559d61da
commit 467b5b7a0b

View File

@@ -109,6 +109,7 @@ udec2str:
; rcx* Counts length of created string
; r8* Dividor for div
; r9* Store arg rsi (uppercase)
; r11* Amount to add to number (for ASCII conversion, lowercase or uppercase)
hex2str:
mov r9, rsi
mov rsi, cnvtBuff
@@ -122,19 +123,20 @@ hex2str:
.notZero:
mov rax, rdi
xor rcx, rcx
mov r8, 87
test r9, r9
cmovz r11, r8
test r9, r9
jz .convert
mov r11, 55
.convert:
xor rdx, rdx
mov r8, 16
div r8
cmp rdx, 10
jb .num
test r9, r9
jz .lower
;.upper:
add rdx, 55
jmp .push
.lower:
add rdx, 87
add rdx, r11
jmp .push
.num:
add rdx, '0'