I started learning assembler, I know C / C ++. Therefore, I decided to build on the knowledge that I already have, and began to disassemble my written code and see how it works.
And immediately came across an illogical moment.
If the assembler has a function to increase the value of the inc eax
argument, then it should be different from adding 1 to the register by adding add eax,1
.
I usually assumed that if there are separate such functions, then they are more efficient ... but if you look at the i++
:
mov eax,dword ptr [i] add eax,1 mov dword ptr [i],eax
What is better to use: inc
or add
in this case?
PS I use Visual Studio 2008.