Is it more efficient to multiply within the address displacement or outside it?
<p>I'm writing an x86 assembly routine that takes as arguments:</p>

<ol>
<li>At <code>[ESP+4]</code>: The number of 32-bit integers following.</li>
<li>Starting at <code>[ESP+8]</code>: A list of 32-bit integers to add up.</li>
</ol>

<p>And it returns the sum of all the integers passed starting at <code>[ESP+8]</code>. So, basically, a C prototype of the function would be:</p>

<p><code>int addN(int numberofitems, ...);</code></p>

<p>I have the option of writing this x86 assembly routine in two ways:</p>

<p>First way (multiplication by item size is within the address displacement):</p>

<pre><code>addN PROC
    mov ecx, dword ptr [esp+4] ; Dec ecx per argument processed
    mov edx, 2 ; Offset into variable length argument list
    xor eax, eax ; Accumulator
    AdderLoop:
        add eax, dword ptr [esp+edx*4]
        inc edx
        dec ecx
        jnz AdderLoop
    ret
addN ENDP
</code></pre>

<p>Second way (size of item is added to <code>edx</code> itself):</p>

<pre><code>addN PROC
    mov ecx, dword ptr [esp+4] ; Dec ecx per argument processed
    mov edx, 8 ; Offset into variable length argument list
    xor eax, eax ; Accumulator
    AdderLoop:
        add eax, dword ptr [esp+edx]
        add edx, 4
        dec ecx
        jnz AdderLoop
    ret
addN ENDP
</code></pre>

<p>Is there any advantage, performance-wise or otherwise, to preferring one way over the other?</p>