Declarations ​
pascal
function ReflectPow2(Value, Max: Integer): Integer; overload;
function ReflectPow2(Value, Min, Max: Integer): Integer; overload;Overload Details
Overload 1 ​
pascal
function ReflectPow2(Value, Max: Integer): Integer; overload;Reflects an integer value in range [0..Max] where Max+1 is a power of two.
| Parameter | Type | Description |
|---|---|---|
Value | Integer | Integer value to reflect. |
Max | Integer | Inclusive upper bound (where Max+1 is a power of 2). |
| Type | Description |
|---|---|
Integer | Reflected integer coordinate in range [0..Max]. |
Overload 2 ​
pascal
function ReflectPow2(Value, Min, Max: Integer): Integer; overload;Reflects an integer value in range [Min..Max] where Max-Min+1 is a power of two.
| Parameter | Type | Description |
|---|---|---|
Value | Integer | Integer value to reflect. |
Min | Integer | Inclusive lower bound. |
Max | Integer | Inclusive upper bound (where Max-Min+1 is a power of 2). |
| Type | Description |
|---|---|
Integer | Reflected integer coordinate in range [Min..Max]. |
Description ​
ReflectPow2 provides optimized power-of-two reflection by utilizing bitwise operations instead of division and modulo instructions.