Skip to content

Commit

Permalink
utility/getByteCount: Fix for 0
Browse files Browse the repository at this point in the history
  • Loading branch information
m-laniakea committed Nov 18, 2019
1 parent 639590d commit f5c9470
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions stspin/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ def getByteCount(value: int) -> int:
:returns: number of bytes to represent the number
"""

assert(value >= 0)

if 0 == value:
return 1

return (value.bit_length() + 7) // 8


Expand Down

0 comments on commit f5c9470

Please sign in to comment.