Skip to content

Conversation

@tarcieri
Copy link
Member

The BoxedUint type couldn't impl the old Zero trait because it requires the value be bound to a constant instead of computed at runtime.

This commit splits the original trait into two traits, adding a fn zero() to Zero which can be used for BoxedUint.

A blanket impl links the two.

This makes it possible to add a Zero trait impl for BoxedUint, which is included in this commit.

The `BoxedUint` type couldn't impl the old `Zero` trait because it
requires the value be bound to a constant instead of computed at
runtime.

This commit splits the original trait into two traits, adding a
`fn zero()` to `Zero` which can be used for `BoxedUint`.

A blanket impl links the two.

This makes it possible to add a `Zero` trait impl for `BoxedUint`, which
is included in this commit.
@tarcieri tarcieri merged commit baaba0c into master Nov 27, 2023
@tarcieri tarcieri deleted the zero-constant-trait branch November 27, 2023 22:39
tarcieri added a commit that referenced this pull request Nov 27, 2023
Now that #335 has been merged allowing `NonZero<BoxedUint>` to be
expressed, we can use it as the operand for remainder, eliminating the
need to handle division by zero at the type system level.

This dramatically simplifies the implementation of
`BoxedResidueParams::new` since now all of the remainder calculations
are infallible, and is more consistent with the other remainder
functions.
tarcieri added a commit that referenced this pull request Nov 27, 2023
Now that #335 has been merged allowing `NonZero<BoxedUint>` to be
expressed, we can use it as the operand for remainder, eliminating the
need to handle division by zero at the type system level.

This dramatically simplifies the implementation of
`BoxedResidueParams::new` since now all of the remainder calculations
are infallible, and is more consistent with the other remainder
functions.
@tarcieri tarcieri mentioned this pull request Jan 22, 2025
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