Selaa lähdekoodia

+ signed DivMod added, closes #6805

git-svn-id: trunk@5132 -
florian 19 vuotta sitten
vanhempi
commit
82d57d9ca8
1 muutettua tiedostoa jossa 12 lisäystä ja 1 poistoa
  1. 12 1
      rtl/objpas/math.pp

+ 12 - 1
rtl/objpas/math.pp

@@ -172,6 +172,7 @@ function EnsureRange(const AValue, AMin, AMax: Double): Double;inline;
 
 
 procedure DivMod(Dividend: Integer; Divisor: Word;  var Result, Remainder: Word);
+procedure DivMod(Dividend: Integer; Divisor: Word; var Result, Remainder: SmallInt);
 
 
 // Sign functions
@@ -2067,7 +2068,7 @@ end;
 // Some CPUs probably allow a faster way of doing this in a single operation...
 // There weshould define CPUDIVMOD in the header mathuh.inc and implement it using asm.
 {$ifndef CPUDIVMOD}
-procedure DivMod(Dividend: Integer; Divisor: Word;  var Result, Remainder: Word);
+procedure DivMod(Dividend: Integer; Divisor: Word; var Result, Remainder: Word);
 
 begin
   Result:=Dividend Div Divisor;
@@ -2075,6 +2076,16 @@ begin
 end;
 {$endif}
 
+
+procedure DivMod(Dividend: Integer; Divisor: Word; var Result, Remainder: SmallInt);
+var
+  UnsignedResult: Word absolute Result;
+  UnsignedRemainder: Word absolute Remainder;
+begin
+  DivMod(Dividend, Divisor, UnsignedResult, UnsignedRemainder);
+end;
+
+
 function ifthen(val:boolean;const iftrue:integer; const iffalse:integer= 0) :integer;
 begin
   if val then result:=iftrue else result:=iffalse;