im curious as to if i were to do inline assembly such as

__asm {

mov eax,0

// more assembly here.....

}

does anyone know of how i can calculate how many bytes the assembly code above i produced will use up in my exe? im wanting to add code with inline assembly and keep track of the size of the added inline assembly this code will add to my exe! thx!

Recommended Answers

All 2 Replies

I believe that on a 32-bit machine 1 assembly command is equal to 32 bits (4 bytes), and on a 64-bit machine 1 assembly command is equal to 64 bits (8 bytes), etc. I am not exactly sure if that is right, but I think it is.

It depends on the instruction, there are shortcuts for longer commands, which in assembly are 2 or 3 'words' but in binary are just 1 opcode.

As an example:
xor eax,eax
Is smaller than
mov eax, 0

Also, take a relative jump for example - it's 5 bytes, but a far jump is 7 (32-bit).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.