Skip to content

Commit

Permalink
Simplify roundToMultiple
Browse files Browse the repository at this point in the history
  • Loading branch information
johnzero7 committed Jan 2, 2020
1 parent b0a28e9 commit 64af8d5
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions bin_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ class TypeFormat:


def roundToMultiple(numToRound, multiple):
remainder = numToRound % multiple
if (remainder == 0):
return numToRound
return numToRound + multiple - remainder
return (numToRound + multiple - 1) // multiple * multiple


def readByte(file):
Expand Down

0 comments on commit 64af8d5

Please sign in to comment.