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

Add: SystemsInteger.division(unchecked:by:) #113

Open
oscbyspro opened this issue Oct 11, 2024 · 0 comments
Open

Add: SystemsInteger.division(unchecked:by:) #113

oscbyspro opened this issue Oct 11, 2024 · 0 comments
Labels
addition oh, so shiny! brrr such code, much wow maybe to do, or not to do?

Comments

@oscbyspro
Copy link
Owner

oscbyspro commented Oct 11, 2024

I haven't added NaturalInteger (#112) yet, but I noticed one more thing: I could efficiently derive a safe 2-by-1 division algorithm from an unsafe protocol requirement. It might reduce some overhead in other algorithms. I've also considered a more elaborate Guarantee-esque (#62) approach, but I don't think it would add much value in this case.

protocol NaturalInteger {
    @unsafe @inlinable static func division(unchecked dividend: Doublet<Self>, by divisor: Nonzero<Self>) -> Division<Self, Self>
}

Of note, I don't believe the 2-by-1 standard library algorithm is a built-in so I could perhaps roll my own at some point.

@oscbyspro oscbyspro added addition oh, so shiny! brrr such code, much wow maybe to do, or not to do? labels Oct 11, 2024
@oscbyspro oscbyspro changed the title Add: NaturalInteger.division(unchecked:by:) Add: SystemsInteger.division(unchecked:by:) Oct 13, 2024
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 maybe to do, or not to do?
Projects
None yet
Development

No branches or pull requests

1 participant