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

Do not XOR with zero #398

Merged
merged 1 commit into from
May 5, 2023
Merged

Conversation

jtraglia
Copy link
Contributor

@jtraglia jtraglia commented May 5, 2023

The staticcheck linter pointed out some unnecessary XORs with zero:

ecc/secp256k1/fr/element.go:235:10: SA4016: z[3] ^ 0 always equals z[3] (staticcheck)
        return (z[3] ^ 0 | z[2] ^ 1 | z[1] ^ 4994812053365940164 | z[0] ^ 4624529908474429119) == 0

ecc/secp256k1/fp/element.go:235:10: SA4016: z[3] ^ 0 | z[2] ^ 0 | z[1] ^ 0 always equals z[3] ^ 0 | z[2] ^ 0 | z[1] (staticcheck)
        return (z[3] ^ 0 | z[2] ^ 0 | z[1] ^ 0 | z[0] ^ 4294968273) == 0

This PR removes those.

@gbotrel gbotrel merged commit f7b99e3 into Consensys:develop May 5, 2023
@jtraglia jtraglia deleted the no-xor-with-zero branch May 5, 2023 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants