4 ms·
There's an error in the pseudocode. cmp ecx, 's' # if (c == 's') jne loop # continue add eax, 1
by torstenvl 3y ago
There's an error in the pseudocode.
cmp ecx, 's' # if (c == 's')
jne loop # continue
add eax, 1 # res++
jmp loop # continue
should be
cmp ecx, 's' # if (c != 's')
jne loop # continue
add eax, 1 # res++
jmp loop # continue
- agumonkey 3y agoI believe the first `jne` should be `je`, right ?
- torstenvl 3y agoNo, the assembler is correct. Jump (early) back to the beginning of the loop if not equal to s; otherwise, continue executing the next instruction (add eax, 1) and then unconditionally jump back to the beginning of the loop.
- agumonkey 3y agowell then there's a magical bit somewhere since both assembly listing are identical
- torstenvl 3y agoYes, the assembly listings are identical. I was very clear that the error was in the pseudocode. That is why I said "There's an error in the pseudocode." There's nothing "magical" about paying attention before condescending to someone.
- agumonkey 3y agoOh my bad, I was not condescending, I simply misread your comment and was then very confused after your first answer. I know I'm the less knowledgeable here, and even then there's nothing to gain in criticizing someone like this online. Sorry again :)
- deleted 3y ago[deleted]