Умножение больших целых чисел

Материал из DRKB



type
   IntNo = record
     Low32, Hi32: DWORD;
   end;

 function Multiply(p, q: DWORD): IntNo;
 var
   x: IntNo;
 begin
   asm
     MOV EAX,[p]
     MUL [q]
     MOV [x.Low32],EAX
     MOV [x.Hi32],EDX
   end;
   Result := x
 end;


// Test the above with:
// So kannst du es testen

var
   r: IntNo;
 begin
    r := Multiply(40000000, 80000000);
    ShowMessage(IntToStr(r.Hi32) + ', ' + IntToStr(r.low32))
 end;


Source: http://www.swissdelphicenter.ch
ID: 04068