Skip to content
Member Filters
Show Inherited
Show Protected
Show abstract
GR32_LowLevel🞂SwapConstrainFunction

SwapConstrain

Constrains an integer value to a range defined by two bounds regardless of their ordering.

Declaration ​

pascal
function SwapConstrain(const Value: Integer; Constrain1, Constrain2: Integer): Integer;

Parameters ​

ParameterTypeDescription
ValueIntegerInteger value to constrain.
Constrain1IntegerFirst boundary constraint.
Constrain2IntegerSecond boundary constraint.

Returns ​

TypeDescription
IntegerValue constrained to [min(Constrain1, Constrain2) .. max(Constrain1, Constrain2)].

Description ​

SwapConstrain restricts Value to the interval bounded by Constrain1 and Constrain2. Unlike Constrain, Constrain1 does not need to be less than or equal to Constrain2; SwapConstrain automatically determines the minimum and maximum of the two bounds.

See also ​