flat assembler
Message board for the users of flat assembler.
Index
> Main > strstrip Code |
Author |
|
eskizo 10 Jul 2009, 13:40
Code: ; At least, remove the last loop and put this: add esp, ecx |
|||
10 Jul 2009, 13:40 |
|
baldr 16 Jul 2009, 08:27
pal,
Having strlen(szAllowed) computed beforehand can reduce inner loop to repne scasb: Code: xor eax, eax mov ecx, -1 mov edi, szAllowed repne scasb not ecx ;note that ecx == strlen(szAllowed)+1 mov edx, ecx mov esi, szIn mov ebx, szOut next: lodsb mov ecx, edx mov edi, szAllowed repne scasb ;this scans szAllowed with trailing \0 jnz next mov [ebx], al ;here we come if character in szAllowed (\0 too) inc ebx test ecx, ecx ;ecx will be 0 iff character was \0 jnz next done: |
|||
16 Jul 2009, 08:27 |
|
pal 16 Jul 2009, 09:14
Cheers baldr. I dunno why I didn't use a repne scasb in the first place, it must have just skipped my mind.
|
|||
16 Jul 2009, 09:14 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.