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

Hoist GCD, XGCD, and remove unsigned constraint #79

Closed
oscbyspro opened this issue Sep 1, 2024 · 2 comments
Closed

Hoist GCD, XGCD, and remove unsigned constraint #79

oscbyspro opened this issue Sep 1, 2024 · 2 comments
Labels
addition oh, so shiny! brrr such code, much wow

Comments

@oscbyspro
Copy link
Owner

I mentioned this in (#66) but it probably deserves its own bullet point.

@oscbyspro oscbyspro added addition oh, so shiny! brrr such code, much wow labels Sep 1, 2024
@oscbyspro oscbyspro added this to the Ultimathnum 0.9.0 milestone Sep 1, 2024
@oscbyspro oscbyspro changed the title Hoist FiniteInteger/bezout(_:) to BinaryInteger and remove unsigned constraint Hoist FiniteInteger/bezout(_:) and remove unsigned constraint Sep 1, 2024
@oscbyspro oscbyspro changed the title Hoist FiniteInteger/bezout(_:) and remove unsigned constraint Hoist GCD, XGCD, and remove unsigned constraint Sep 1, 2024
@oscbyspro
Copy link
Owner Author

Looks like T.predicate(x) then T(unsafe: x) is a minor optimization compared to T(exactly: x) for U256, etc.

@oscbyspro
Copy link
Owner Author

oscbyspro commented Sep 1, 2024

Wow. GitHub changed their monospace font background—praise be.

oscbyspro added a commit that referenced this issue Sep 2, 2024
I looked at some assembly and the compiler can de-duplicate appendix checks w.r.t. BinaryInteger/magnitude(). Calling magnitude() makes the code simpler when T is small, and it doesn't really matter otherwise. I also liked the helper struct, so I reinstated it.
oscbyspro added a commit that referenced this issue Sep 2, 2024
Seems like the nonoptional approach is a bit faster, at least for sizes beyond machine words.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition oh, so shiny! brrr such code, much wow
Projects
None yet
Development

No branches or pull requests

1 participant