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

bigint: Rename PartialModulus to Modulus, Modulus to OwnedModulusWithOne. #1796

Merged
merged 2 commits into from
Nov 6, 2023

Conversation

briansmith
Copy link
Owner

Originally we only had Modulus. Then we had a need for a temporary Modulus without oneRR so we created PartialModulus. However, there is really nothing "partial" about them. So, improve the naming by renaming PartialModulus to Modulus and Modulus to OwnedModulusWithOne. In the future we may refactor things further to separate the ownership aspect from the "has oneRR" aspect.

Instead of just doing a straightforward rename, take this opportunity to refactor the code so that it uses the new Modulus whenever oneRR() isn't used. This eliminates the duplication of the APIs of the two modulus types, and the duplication of elem_mul and elem_mul_.

Originally we only had `Modulus`. Then we had a need for a
temporary `Modulus` without `oneRR` so we created `PartialModulus`.
However, there is really nothing "partial" about them. So, improve
the naming by renaming `PartialModulus` to `Modulus` and `Modulus`
to `OwnedModulusWithOne`. In the future we may refactor things
further to separate the ownership aspect from the "has oneRR"
aspect.

Instead of just doing a straightforward rename, take this
opportunity to refactor the code so that it uses the new `Modulus`
whenever `oneRR()` isn't used. This eliminates the duplication of
the APIs of the two modulus types, and the duplication of
`elem_mul` and `elem_mul_`.
@briansmith briansmith self-assigned this Nov 6, 2023
Copy link

codecov bot commented Nov 6, 2023

Codecov Report

Merging #1796 (7fab448) into main (1659f14) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1796      +/-   ##
==========================================
+ Coverage   96.00%   96.02%   +0.01%     
==========================================
  Files         137      137              
  Lines       20796    20789       -7     
  Branches      226      226              
==========================================
- Hits        19966    19962       -4     
+ Misses        792      790       -2     
+ Partials       38       37       -1     
Files Coverage Δ
src/arithmetic/bigint.rs 99.31% <100.00%> (+<0.01%) ⬆️
src/arithmetic/bigint/modulus.rs 99.24% <100.00%> (-0.08%) ⬇️
src/rsa/keypair.rs 96.64% <100.00%> (+0.04%) ⬆️
src/rsa/public_key.rs 99.10% <100.00%> (+<0.01%) ⬆️
src/rsa/public_modulus.rs 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@briansmith briansmith merged commit e51c88a into main Nov 6, 2023
138 checks passed
@briansmith briansmith deleted the b/no-partial-modulus branch November 6, 2023 20:52
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.

1 participant