Declarations ​
pascal
function Div255(Value: Word): Word;
function FastDiv255(Value: Word): Word;
function Div255Round(Value: Word): Word;Overload Details
Overload 1 ​
pascal
function Div255(Value: Word): Word;Fast integer division by 255 for inputs in range [0..$FFFF].
| Parameter | Type | Description |
|---|---|---|
Value | Word | 16-bit word value to divide by 255 (valid for [0..65535]). |
| Type | Description |
|---|---|
Word | Result of Value div 255. |
Overload 2 ​
pascal
function FastDiv255(Value: Word): Word;Ultra-fast integer division by 255 for inputs in range [0..255255].*
| Parameter | Type | Description |
|---|---|---|
Value | Word | 16-bit word value to divide by 255 (valid for [0..65025]). |
| Type | Description |
|---|---|
Word | Result of Value div 255. |
Overload 3 ​
pascal
function Div255Round(Value: Word): Word;Fast rounded integer division by 255 for inputs in range [0..255255].*
| Parameter | Type | Description |
|---|---|---|
Value | Word | 16-bit word value to divide and round by 255 (valid for [0..65025]). |
| Type | Description |
|---|---|
Word | Rounded result of Round(Value / 255). |
Description ​
Div255, FastDiv255, and Div255Round perform high-speed integer division by 255 without using expensive hardware division instructions. They use reciprocal multiplication and shift magic numbers, making them highly efficient for 8-bit channel blending and alpha scaling.