mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 17:39:24 +02:00
22 lines
324 B
ObjectPascal
22 lines
324 B
ObjectPascal
{$mode objfpc}
|
|
{$assertions on}
|
|
|
|
procedure DivMod(a: Int64; b: Int64; out res, rem: Int64); inline;
|
|
begin
|
|
res:=a div b; rem:=a-b*res;
|
|
end;
|
|
|
|
procedure Test;
|
|
var
|
|
res, rem: Int64;
|
|
begin
|
|
res:=5; DivMod(res {!}, 2, res {!}, rem);
|
|
Assert(res=2); // OK
|
|
Assert(rem=1); // "2-2*2 = -2" if inlined
|
|
end;
|
|
|
|
begin
|
|
test;
|
|
end.
|
|
|