📄 jcllogic.pas
字号:
procedure SwapOrd(var I, J: Int64);
var
T: Int64;
begin
T := I;
I := J;
J := T;
end;
procedure SwapOrd(var I, J: Shortint);
var
T: Shortint;
begin
T := I;
I := J;
J := T;
end;
procedure SwapOrd(var I, J: Smallint);
var
T: Smallint;
begin
T := I;
I := J;
J := T;
end;
procedure SwapOrd(var I, J: Word);
var
T: Word;
begin
T := I;
I := J;
J := T;
end;
function IncLimit(var B: Byte; const Limit, Incr: Byte): Byte;
begin
if (B + Incr) <= Limit then
Inc(B, Incr);
Result := B;
end;
function IncLimit(var B: Shortint; const Limit, Incr: Shortint): Shortint;
begin
if (B + Incr) <= Limit then
Inc(B, Incr);
Result := B;
end;
function IncLimit(var B: Smallint; const Limit, Incr: Smallint): Smallint;
begin
if (B + Incr) <= Limit then
Inc(B, Incr);
Result := B;
end;
function IncLimit(var B: Word; const Limit, Incr: Word): Word;
begin
if (B + Incr) <= Limit then
Inc(B, Incr);
Result := B;
end;
function IncLimit(var B: Integer; const Limit, Incr: Integer): Integer;
begin
if (B + Incr) <= Limit then
Inc(B, Incr);
Result := B;
end;
function IncLimit(var B: Cardinal; const Limit, Incr: Cardinal): Cardinal;
begin
if (B + Incr) <= Limit then
Inc(B, Incr);
Result := B;
end;
function IncLimit(var B: Int64; const Limit, Incr: Int64): Int64;
begin
if (B + Incr) <= Limit then
Inc(B, Incr);
Result := B;
end;
function DecLimit(var B: Byte; const Limit, Decr: Byte): Byte;
begin
if (B - Decr) >= Limit then
Dec(B, Decr);
Result := B;
end;
function DecLimit(var B: Shortint; const Limit, Decr: Shortint): shortint;
begin
if (B - Decr) >= Limit then
Dec(B, Decr);
Result := B;
end;
function DecLimit(var B: Smallint; const Limit, Decr: Smallint): Smallint;
begin
if (B - Decr) >= Limit then
Dec(B, Decr);
Result := B;
end;
function DecLimit(var B: Word; const Limit, Decr: Word): Word;
begin
if (B - Decr) >= Limit then
Dec(B, Decr);
Result := B;
end;
function DecLimit(var B: Integer; const Limit, Decr: Integer): Integer;
begin
if (B - Decr) >= Limit then
Dec(B, Decr);
Result := B;
end;
function DecLimit(var B: Cardinal; const Limit, Decr: Cardinal): Cardinal;
begin
if (B - Decr) >= Limit then
Dec(B, Decr);
Result := B;
end;
function DecLimit(var B: Int64; const Limit, Decr: Int64): Int64;
begin
if (B - Decr) >= Limit then
Dec(B, Decr);
Result := B;
end;
function IncLimitClamp(var B: Byte; const Limit, Incr: Byte): Byte;
begin
if (B + Incr) <= Limit then
Inc(B, Incr)
else
B := Limit;
Result := B;
end;
function IncLimitClamp(var B: Shortint; const Limit, Incr: Shortint): Shortint;
begin
if (B + Incr) <= Limit then
Inc(B, Incr)
else
B := Limit;
Result := B;
end;
function IncLimitClamp(var B: Smallint; const Limit, Incr: Smallint): Smallint;
begin
if (B + Incr) <= Limit then
Inc(B, Incr)
else
B := Limit;
Result := B;
end;
function IncLimitClamp(var B: Word; const Limit, Incr: Word): Word;
begin
if (B + Incr) <= Limit then
Inc(B, Incr)
else
B := Limit;
Result := B;
end;
function IncLimitClamp(var B: Integer; const Limit, Incr: Integer): Integer;
begin
if (B + Incr) <= Limit then
Inc(B, Incr)
else
B := Limit;
Result := B;
end;
function IncLimitClamp(var B: Cardinal; const Limit, Incr: Cardinal): Cardinal;
begin
if (B + Incr) <= Limit then
Inc(B, Incr)
else
B := Limit;
Result := B;
end;
function IncLimitClamp(var B: Int64; const Limit, Incr: Int64): Int64;
begin
if (B + Incr) <= Limit then
Inc(B, Incr)
else
B := Limit;
Result := B;
end;
function DecLimitClamp(var B: Byte; const Limit, Decr: Byte): Byte;
begin
if (B - Decr) >= Limit then
Dec(B, Decr)
else
B := Limit;
Result := B;
end;
function DecLimitClamp(var B: Shortint; const Limit, Decr: Shortint): Shortint;
begin
if (B - Decr) >= Limit then
Dec(B, Decr)
else
B := Limit;
Result := B;
end;
function DecLimitClamp(var B: Smallint; const Limit, Decr: Smallint): Smallint;
begin
if (B - Decr) >= Limit then
Dec(B, Decr)
else
B := Limit;
Result := B;
end;
function DecLimitClamp(var B: Word; const Limit, Decr: Word): Word;
begin
if (B - Decr) >= Limit then
Dec(B, Decr)
else
B := Limit;
Result := B;
end;
function DecLimitClamp(var B: Integer; const Limit, Decr: Integer): Integer;
begin
if (B - Decr) >= Limit then
Dec(B, Decr)
else
B := Limit;
Result := B;
end;
function DecLimitClamp(var B: Cardinal; const Limit, Decr: Cardinal): Cardinal;
begin
if (B - Decr) >= Limit then
Dec(B, Decr)
else
B := Limit;
Result := B;
end;
function DecLimitClamp(var B: Int64; const Limit, Decr: Int64): Int64;
begin
if (B - Decr) >= Limit then
Dec(B, Decr)
else
B := Limit;
Result := B;
end;
function Max(const B1, B2: Byte): Byte;
begin
if B1 > B2 then
Result := B1
else
Result := B2;
end;
function Min(const B1, B2: Byte): Byte;
begin
if B1 < B2 then
Result := B1
else
Result := B2;
end;
function Max(const B1, B2: Shortint): Shortint;
begin
if B1 > B2 then
Result := B1
else
Result := B2;
end;
function Max(const B1, B2: Smallint): Smallint;
begin
if B1 > B2 then
Result := B1
else
Result := B2;
end;
function Min(const B1, B2: Shortint): Shortint;
begin
if B1 < B2 then
Result := B1
else
Result := B2;
end;
function Min(const B1, B2: Smallint): Smallint;
begin
if B1 < B2 then
Result := B1
else
Result := B2;
end;
function Max(const B1, B2: Word): Word;
begin
if B1 > B2 then
Result := B1
else
Result := B2;
end;
function Max(const B1, B2: Int64): Int64;
begin
if B1 > B2 then
Result := B1
else
Result := B2;
end;
function Min(const B1, B2: Word): Word;
begin
if B1 < B2 then
Result := B1
else
Result := B2;
end;
function Max(const B1, B2: Integer): Integer;
begin
if B1 > B2 then
Result := B1
else
Result := B2;
end;
function Min(const B1, B2: Integer): Integer;
begin
if B1 < B2 then
Result := B1
else
Result := B2;
end;
function Max(const B1, B2: Cardinal): Cardinal;
begin
if B1 > B2 then
Result := B1
else
Result := B2;
end;
function Min(const B1, B2: Cardinal): Cardinal;
begin
if B1 < B2 then
Result := B1
else
Result := B2;
end;
function Min(const B1, B2: Int64): Int64;
begin
if B1 < B2 then
Result := B1
else
Result := B2;
end;
// History:
// $Log: JclLogic.pas,v $
// Revision 1.14 2005/02/24 16:34:40 marquardt
// remove divider lines, add section lines (unfinished)
//
// Revision 1.13 2004/11/06 01:57:15 mthoma
// Added CountBitsSet (Pointer...) by Andreas Schmidt. Some minor changes.
//
// Revision 1.12 2004/10/24 01:04:42 mthoma
// Removed all contributions by you know who.
//
// Revision 1.11 2004/09/30 07:50:29 marquardt
// remove PH contributions
//
// Revision 1.10 2004/07/28 18:00:50 marquardt
// various style cleanings, some minor fixes
//
// Revision 1.9 2004/06/14 13:05:18 marquardt
// style cleaning ENDIF, Tabs
//
// Revision 1.8 2004/06/14 11:05:51 marquardt
// symbols added to all ENDIFs and some other minor style changes like removing IFOPT
//
// Revision 1.7 2004/05/05 00:09:59 mthoma
// Updated headers: Added donors as contributors, adjusted the initial authors, added cvs names when they were not obvious. Changed $data to $date where necessary,
//
// Revision 1.6 2004/04/14 23:07:34
// add missing types to different functions
// add pure pascal implementations
// some bugfixes, a.o. sar with Count >= bit count
//
// Revision 1.5 2004/04/06 04:53:18
// adapt compiler conditions, add log entry
//
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -