-
Notifications
You must be signed in to change notification settings - Fork 344
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
Add missing TryFrom impls #1870
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Just a CHANGELOG and then this is good to go
@@ -270,12 +271,24 @@ impl Int128 { | |||
} | |||
} | |||
|
|||
impl NumConsts for Int128 { | |||
const ZERO: Self = Self::zero(); | |||
const ONE: Self = Self::one(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea why zero()
and one()
are functions and not const
s? Should this be changed for the public interface too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea why those are functions. I think using constants is more common, but it doesn't really make a difference. As far as I know, they can be used interchangeably.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the standard library types don't have zero and one. So it does not matter much I guess.
closes #1863
I also ended up adding the rest of the missing unsigned to signed
TryFrom
impls and signed to unsignedTryFrom
impls because I needed some more for theSignedDecimal
PR:Uint{64,128,256,512}
->Int64
Uint{128,256,512}
->Int128
Uint{256, 512}
->Int256
Uint512
->Int512
Int{64,128,256,512}
->Uint{64,128,256,512}