New version can be called in the same way
invoke htodw,addr HexString
it 13 bytes shorter and runs ~ 30-35% faster.
Based of ideas of previous roy+Svin version.
But stack frame optimized + someting else
invoke htodw,addr HexString
it 13 bytes shorter and runs ~ 30-35% faster.
Based of ideas of previous roy+Svin version.
But stack frame optimized + someting else
.386
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
.code
; #########################################################################
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
htodw proc FORCENOFRAME
ptHexString equ [esp+4]
mov ecx,ptHexString
xor edx,edx
ALIGN 4
htodw_loop:
mov al,[ecx]
inc ecx
sub al,"0"
js htodw_endloop
shl edx,4
cmp al,9
jbe htodw_addnumber
sub al,"a" - "0" - 10
jns htodw_addnumber
add al,20h
htodw_addnumber:
xor dl,al
jmp htodw_loop
htodw_endloop: mov eax,edx
ret 4
htodw endp
OPTION PROLOGUE:DEFAULTOPTION
OPTION EPILOGUE:DEFAULTOPTION
; #########################################################################
end
nice work svin !
in fact i found usefull to do that :
rename your htodw to hztodw
and make a htodw that accept a length parameter (it might always be usefull)
in fact i found usefull to do that :
rename your htodw to hztodw
and make a htodw that accept a length parameter (it might always be usefull)