Skip to content

Commit

Permalink
Remove side effect of digest on register state
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicoretti committed Apr 14, 2024
1 parent 89cc3c5 commit f0c2894
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/crc/_crc.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,8 @@ def digest(self) -> int:
"""
See `AbstractRegister.digest`
"""
if self._config.reverse_output:
self.register = self.reverse()
return self.register ^ self._config.final_xor_value
value = self.reverse() if self._config.reverse_output else self.register
return value ^ self._config.final_xor_value

def reverse(self) -> int:
"""
Expand Down

0 comments on commit f0c2894

Please sign in to comment.