SegmentedSegmentTree
SegmentedSegmentTree
🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲
Segmented Segment Tree
by Clober
____/\___/\\____/\__ ____/\\___/\\////___/\\__ __/\\/\____/\\///__/\\/\__ ____/\\/\/\__/\\\\\_____/\\/\/\__ __/\\/\/\___/\\///////\___/\\/\/\__ /\\\\\\\\_\/\__\//\_/\\\\\\\\ _\///////////\\//\//\____/\__\///////////\\//_\/\___\///\\\\\/___\/\__ _\///____\/////////___\///_
4 Layers of 64-bit nodes, hence 464
🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲🌲
SegmentedSegmentTreeError
error SegmentedSegmentTreeError(uint256 errorCode)
Core
struct Core {
mapping(uint256 => uint256)[4] layers;
}
LayerIndex
struct LayerIndex {
uint256 group;
uint256 node;
}
get
function get(struct SegmentedSegmentTree.Core core, uint256 index) internal view returns (uint64 ret)
total
function total(struct SegmentedSegmentTree.Core core) internal view returns (uint64)
query
function query(struct SegmentedSegmentTree.Core core, uint256 left, uint256 right) internal view returns (uint64 sum)
update
function update(struct SegmentedSegmentTree.Core core, uint256 index, uint64 value) internal returns (uint64 replaced)