TreeMath
Last updated
Last updated
Author: Trader Joe
This library contains functions to interact with a tree of TreeUint24.
Returns true if the tree contains the id
Parameters
tree
TreeUint24
The tree
id
uint24
The id
Returns
<none>
bool
True if the tree contains the id
Adds the id to the tree and returns true if the id was not already in the tree It will also propagate the change to the parent levels.
Parameters
tree
TreeUint24
The tree
id
uint24
The id
Returns
<none>
bool
True if the id was not already in the tree
Removes the id from the tree and returns true if the id was in the tree. It will also propagate the change to the parent levels.
Parameters
tree
TreeUint24
The tree
id
uint24
The id
Returns
<none>
bool
True if the id was in the tree
Returns the first id in the tree that is lower than or equal to the given id. It will return type(uint24).max if there is no such id.
Parameters
tree
TreeUint24
The tree
id
uint24
The id
Returns
<none>
uint24
The first id in the tree that is lower than or equal to the given id
Returns the first id in the tree that is higher than or equal to the given id. It will return 0 if there is no such id.
Parameters
tree
TreeUint24
The tree
id
uint24
The id
Returns
<none>
uint24
The first id in the tree that is higher than or equal to the given id
Returns the first bit in the given leaves that is strictly lower than the given bit. It will return type(uint256).max if there is no such bit.
Parameters
leaves
bytes32
The leaves
bit
uint8
The bit
Returns
<none>
uint256
The first bit in the given leaves that is strictly lower than the given bit
Returns the first bit in the given leaves that is strictly higher than the given bit. It will return type(uint256).max if there is no such bit.
Parameters
leaves
bytes32
The leaves
bit
uint8
The bit
Returns
<none>
uint256
The first bit in the given leaves that is strictly higher than the given bit