@@ -358,36 +358,36 @@ UInt64_Mul proc
358358 mov dx , 14 ; copy the vartype-word for decimal it is 14 = &HE to the register dx
359359 mov [ edi + 0 ], dx ; copy the value in register dx to the Variant to the first int16-slot
360360 mov dl , 0 ; copy the number of precision it is 0 to the register dl (->integer, otherwise between 0 and 255)
361- mov dh , 0 ; copy the sign-word it is 0 to the register dh (->unsigned, otherwise &H80 is negative sign)
361+ mov dh , 0 ; copy the sign-word it is 0 to the register dh (->unsigned, otherwise &H80 is negative sign)
362362 mov [ edi + 2 ], dx ; copy the value in register dx to the Variant into the second int16-slot
363- ;mit 0 vorbelegen
364- ;mov ecx , 0 ; copy 0 to the register ECX
363+ ;mit 0 vorbelegen
364+ ;mov ecx , 0 ; copy 0 to the register ECX
365365 ;mov [edi+ 4], ecx ; copy the register ECX to the Variant into the second Int32 slot
366- ;mov [edi+ 8], ecx
367- ;mov [edi+12], ecx
366+ ;mov [edi+ 8], ecx
367+ ;mov [edi+12], ecx
368368
369369 ; 2. Multiply the Lo dword of multiplier times Lo dword of multiplicand.
370370 mov eax , [ esp + 4 ] ; copy the Lo dword of multiplier to register EAX
371371 mul dword ptr [ esp + 12 ] ; Multiply Lo dwords EAX * ECX
372372 mov [ edi + 8 ], eax ; Save Lo dword of product to the third Variant slot
373- mov ecx , edx ; Save Hi dword of product into the register EBX
374-
375- ; 3. Multiply Lo dword of multiplier times Hi dword of Multiplicand
376- mov eax , [ esp + 4 ] ; copy the lo dword of multiplier to register EAX
377- mul dword ptr [ esp + 16 ] ; multiply register EAX times Hi dword of Multiplicand
378- add eax , ecx ; Add to the partial product
379- adc edx , 0 ; add the carryflag to EDX which contains the hi dword of the multiplication-result
380- mov ebx , eax ; Save partial product for now
381- mov ecx , edx ;
382-
373+ mov ecx , edx ; Save Hi dword of product into the register EBX
374+
375+ ; 3. Multiply Lo dword of multiplier times Hi dword of Multiplicand
376+ mov eax , [ esp + 4 ] ; copy the lo dword of multiplier to register EAX
377+ mul dword ptr [ esp + 16 ] ; multiply register EAX times Hi dword of Multiplicand
378+ add eax , ecx ; Add to the partial product
379+ adc edx , 0 ; add the carryflag to EDX which contains the hi dword of the multiplication-result
380+ mov ebx , eax ; Save partial product for now
381+ mov ecx , edx ;
382+
383383 ; 4. Multiply the Hi dword of multiplier times Lo dword of Multiplicand
384384 mov eax , [ esp + 8 ] ; Get Hi dword of Multiplier
385- mul dword ptr [ esp + 12 ] ; Multiply by Lo dword of Multiplicand
386- add eax , ebx ; Add to the partial product.
385+ mul dword ptr [ esp + 12 ] ; Multiply by Lo dword of Multiplicand
386+ add eax , ebx ; Add to the partial product.
387387 mov [ edi + 12 ], eax ; Save the partial product.
388- adc ecx , edx ; Add in the carry!
388+ adc ecx , edx ; Add in the carry!
389389 pushfd ; Save carry out here.
390-
390+
391391 ; 5. Multiply the two Hi dwords together,
392392 mov eax , [ esp + 8 ] ; Get Hi dword of Multiplier
393393 mul dword ptr [ esp + 16 ] ; Multiply by Hi dword of Multiplicand
@@ -396,7 +396,7 @@ UInt64_Mul proc
396396 adc edx , 0 ; Don't forget the carry!
397397 mov [ edi + 4 ], eax ; Save the partial product.
398398 ;mov [edi+ 0], edx ; Nope! sorry we only have 96 Bit
399-
399+
400400 ret 20 ; return remove 20 bytes from call stack
401401
402402UInt64_Mul endp
0 commit comments