+ signed DivMod added, closes #6805

git-svn-id: trunk@5132 -
This commit is contained in:
florian 2006-10-31 22:19:04 +00:00
parent 5c9b39549a
commit 82d57d9ca8

View File

@ -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;