Returns the height of a generalized tree index. The height of the root node is zero, all other nodes have the height of their parent plus one.
(index: U256)
| 115 | |
| 116 | |
| 117 | def gti_height(index: U256) -> Uint: |
| 118 | """ |
| 119 | Returns the height of a generalized tree index. The height of the root node |
| 120 | is zero, all other nodes have the height of their parent plus one. |
| 121 | """ |
| 122 | # TODO: more efficient implementation? |
| 123 | height = Uint(0) |
| 124 | while index > GTI_ROOT: |
| 125 | height += 1 |
| 126 | index >>= 1 |
| 127 | return height |
| 128 | |
| 129 | |
| 130 | def gti_vector(root: U256, index, height: Uint) -> U256: |
no outgoing calls
no test coverage detected