Skip to main content

decomposeNonZeroInterval

Git Source

Helper for calculating range size for a non-zero-starting interval.

The bitmath here decomposes the interval into two parts that in combination represent the compact range needed to express the interval.

function decomposeNonZeroInterval(uint256 begin, uint256 end) pure returns (uint256 left, uint256 right);

Parameters

NameTypeDescription
beginuint256The start of the interval of the range's coverage (inclusive).
enduint256The end of the interval of the range's coverage (exclusive).

Returns

NameTypeDescription
leftuint256The left part of the interval.
rightuint256The right part of the interval.