Advertisement
WarPie90

Untitled

Mar 14th, 2016
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.96 KB | None | 0 0
  1. ...
  2. while True do
  3. begin
  4.   op := Bytecode.Code[pc];
  5.   Inc(pc);
  6.   BIN_SUB:
  7.     begin
  8.       right := frame.Pop();
  9.       frame.Top.SUB(right, bytecode.Variables[op.arg]);
  10.       frame.SetTop(bytecode.Variables[op.arg]);
  11.     end;
  12.   BIN_MUL:
  13.     begin
  14.       right := frame.Pop();
  15.       frame.Top.MUL(right, bytecode.Variables[op.arg]);
  16.       frame.SetTop(bytecode.Variables[op.arg]);
  17.     end;
  18. ...
  19.  
  20. procedure SetIntDest(var dest:TEpObject; constref value:epInt); inline;
  21. begin
  22.   if dest is TIntObject then
  23.     TIntObject(dest).value := value
  24.   else
  25.   begin
  26.     if not(dest is TNoneObject) then dest.Free;
  27.     dest := TIntObject.Create(value);
  28.   end;
  29. end;
  30.  
  31. ...
  32.  
  33. procedure TIntObject.MUL(other:TEpObject; var dest:TEpObject);
  34. begin
  35.   if (other is TIntObject) then
  36.     SetIntDest(dest, self.value * TIntObject(other).value)
  37.   else if (other is TFloatObject) then
  38.     SetFloatDest(dest, self.value * TFloatObject(other).value)
  39.   else
  40.     inherited;
  41. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement