I try to do a comparison between two strings, but I get a Segmentation Fault, can you guys help me to find the problem ?
Here is the code : http://pastebin.com/Ji2VGH6N
Are you comparing two int* or char*? The C is for char, the code you wrote is for weirdly aligned ints.
Either way, that's way too many instructions...
pop edx
pop esi
pop edi
pop ecx
push ecx
repnz cmpsb ; replace with cmpsd if you want to compare ints
pop eax
sub eax, ecx
push ecx
push eax
fild [esp]
pop eax
fild [esp]
pop eax
fdiv
jmp edx
(Untested. Written off-the-cuff.)
Name:
Anonymous2013-10-31 20:45
Why do you need floating point division to compare strings? x86 is a heaping pile of shit, but string comparison is at least one hoop you don't have to jump through. It has rep cmpsb and family, which is pretty convenient.