4 ms·
This triggers a vague memory of trying to figure out why my assembler (masm?) was outputting a LEA instead of a MOV. I can't remember why. Maybe LEA was more ef
by mordechai9000 11mo ago
This triggers a vague memory of trying to figure out why my assembler (masm?) was outputting a LEA instead of a MOV. I can't remember why. Maybe LEA was more efficient, or MOV didn't really support the addressing mode and the assembler just quietly fixed it for you.
In any case, I felt slightly betrayed by the assembler for silently outputting something I didn't tell it to.
- HarHarVeryFunny 11mo agoLEA and MOV are doing different things. LEA is just calculating the effective address, but MOV calculates the address then retrieves the value stored at that address. e.g. If base + (index * scale) + offset = 42, and the value at address 42 is 3, then: LEA rax, [base + index * scale + offset] will set rax = 42 MOV rax, [base + index * scale + offset] will set rax = 3
- dataflow 11mo agoI assumed they're referring to register-register moves?
- HarHarVeryFunny 11mo agoOK, so: LEA eax, [ebx] instead of: MOV eax, ebx But of course: MOV eax, [ebx] is not the same.