Skip to content

Commit

Permalink
Merge pull request #13 from kcalvinalvin/2024-08-26-change-leaves-to-…
Browse files Browse the repository at this point in the history
…numleaves

Change the wording from leaves to numleaves
  • Loading branch information
kcalvinalvin authored Aug 26, 2024
2 parents 1120b2b + 7866be1 commit 4743f78
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pytreexo.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ def tree_rows(n: int) -> int:
return 0 if n == 0 else (n - 1).bit_length()


def root_position(leaves: int, row: int, total_rows: int) -> int:
def root_position(numleaves: int, row: int, total_rows: int) -> int:
mask = (2 << total_rows) - 1
before = leaves & (mask << (row + 1))
before = numleaves & (mask << (row + 1))
shifted = (before >> row) | (mask << (total_rows + 1 - row))
return shifted & mask

Expand Down

0 comments on commit 4743f78

Please sign in to comment.