Declarations ​
pascal
function TestClip(var A, B: Integer; const Size: Integer): Boolean; overload;
function TestClip(var A, B: Integer; const Start, Stop: Integer): Boolean; overload;Overload Details
Overload 1 ​
pascal
function TestClip(var A, B: Integer; const Size: Integer): Boolean; overload;Orders A and B, then clips them to interval [0..Size-1].
| Parameter | Type | Description |
|---|---|---|
A, B | Integer | Variables to order and clip to range [0..Size-1]. |
Size | Integer | Upper size constraint (defines interval [0..Size-1]). |
| Type | Description |
|---|---|
Boolean | Returns True if the clipped range overlaps with [0..Size-1]; False otherwise. |
Overload 2 ​
pascal
function TestClip(var A, B: Integer; const Start, Stop: Integer): Boolean; overload;Orders A and B, then clips them to interval [Start..Stop].
| Parameter | Type | Description |
|---|---|---|
A, B | Integer | Variables to order and clip to range [Start..Stop]. |
Start | Integer | Start boundary of interval. |
Stop | Integer | Stop boundary of interval. |
| Type | Description |
|---|---|
Boolean | Returns True if the clipped range overlaps with [Start..Stop]; False otherwise. |
Description ​
TestClip first ensures A <= B (swapping them if necessary using TestSwap), and then clips both A and B to fit within the specified bounds ([0..Size-1] or [Start..Stop]).
It returns True if the resulting interval [A..B] has common points with the target bounding range, or False if the range lies entirely outside.