Skip to content

Implement PartialEq for references on all math types - LHS and tests #1382

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

Conversation

uint
Copy link
Contributor

@uint uint commented Aug 15, 2022

Adds things to #1350:

  • tests
  • PartialEq implementation for when LHS operand is a reference

@uint uint requested review from webmaster128 and ueco-jb August 15, 2022 12:23
Copy link
Member

@webmaster128 webmaster128 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏅

@uint uint merged commit fc89a44 into 1349-implement-partialeq-for-reference-math-types Aug 15, 2022
@uint uint deleted the 1349-implement-parialeq-lhs branch August 15, 2022 12:30
Comment on lines +1190 to +1191
Uint512::from(lhs as u64),
Uint512::from(rhs as u64),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates signed ints and then unsafely casts them to u64, right? Can you use 1u64 literals instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, can do, just thought this was less verbose

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got scared of unsafe casts after seeing a some bug in a TypeScript app that popped up on the user's machine but could have been cought at compile time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there something like Uint512::from<u64>(lhs) for multiple versions of a trait implementation, even if from is not generic?

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