Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid negative values and minor refactoring #1943

Merged
merged 3 commits into from
Jul 2, 2020
Merged

Avoid negative values and minor refactoring #1943

merged 3 commits into from
Jul 2, 2020

Conversation

hwwhww
Copy link
Contributor

@hwwhww hwwhww commented Jun 30, 2020

Issue

Fix #1923

How did I fix it

  • Change (-len(bytez) % BYTES_PER_CUSTODY_ATOM) to ((BYTES_PER_CUSTODY_ATOM - (len(bytez) % BYTES_PER_CUSTODY_ATOM)) % BYTES_PER_CUSTODY_ATOM)
  • Avoid negative index
  • Some other minor refactoring

p.s. state.justification_bits[:-1] will be resolved in #1746

/cc @ericsson49

@hwwhww hwwhww added the general:presentation Presentation (as opposed to content) label Jun 30, 2020
@hwwhww hwwhww requested review from djrtwo and protolambda June 30, 2020 13:59
@djrtwo djrtwo merged commit 5a9dd44 into dev Jul 2, 2020
@djrtwo djrtwo deleted the avoid-neg-op branch July 2, 2020 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general:presentation Presentation (as opposed to content)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_custody_atoms: avoid application of modulo operation (%) to a negative value
3 participants