[][src]Function flat_tree::index

pub const fn index(depth: usize, offset: usize) -> usize

Returns the flat-tree of the tree node at the specified depth and offset.

Examples

assert_eq!(flat_tree::index(0, 0), 0);
assert_eq!(flat_tree::index(0, 1), 2);
assert_eq!(flat_tree::index(0, 2), 4);
assert_eq!(flat_tree::index(1, 2), 9);
assert_eq!(flat_tree::index(1, 3), 13);
assert_eq!(flat_tree::index(2, 1), 11);
assert_eq!(flat_tree::index(2, 2), 19);
assert_eq!(flat_tree::index(3, 0), 7);
assert_eq!(flat_tree::index(3, 1), 23);