Posted July 15, 201411 yr hello tuts4you, i got a simple math question. when a lenght of a string divisible by 36, the counter should be added by 10.So i got this working but i bet there is a better/cleaner way to do this. this is what i got and it works, but could someone help me to improve my function? invoke lstrlen, Addr szString .if eax <= 36 push 10 .elseif eax <= 72 ; + 36 push 20 ; + 10 .elseif eax <= 108 ; + 36 push 30 ; + 10 etc.. .elseif eax<= 144 push 40 .elseif eax <= 180 push 50 .elseif eax <= 216 push 60 .elseif eax <= 252 push 70 .else push 80 .endif
July 15, 201411 yr // -- divide length by 36, add one CDQ MOV ECX,24h DIV ECX INC EAX // -- if result is more than 8, set it to 8 CMP EAX,8 JBE @F MOV EAX,8 @@: // -- multiply result by 10, in EAX will be the value we need MOV ECX,0Ah MUL ECX
July 19, 201411 yr Author again tuts4you helped me out, a LOT of thanks kao and Aguila, problem solved
Create an account or sign in to comment