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

Rework binary integer description error-handling #134

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

oscbyspro
Copy link
Owner

@oscbyspro oscbyspro commented Nov 20, 2024

This patch reworks binary integer description error-handling using the Optional<Fallible<T>> approach (#95). In other words: invalid inputs return nil, and out-of-bounds inputs return the truncated results and an error indicator—like basically every other BinaryInteger operation. Note that only TextInt exposes the new functionality and that the methods on BinaryInteger replace error with nil. Additionally, this patch removes TextInt.Error (#125) and all StaticString conveniences (awaiting a unified abstraction). It is also a bit faster.

@oscbyspro oscbyspro added addition oh, so shiny! brrr such code, much wow subtraction huh? where did it go? labels Nov 20, 2024
@oscbyspro oscbyspro added this to the Ultimathnum 0.12.0 milestone Nov 20, 2024
@oscbyspro
Copy link
Owner Author

oscbyspro commented Nov 20, 2024

-&0 is (value: 1, error: true) for all binary integer types, so there are no unchecked() convenience methods.

@oscbyspro oscbyspro merged commit afa53a2 into main Nov 20, 2024
@oscbyspro oscbyspro deleted the features/textint-error-handling branch November 20, 2024 09:23
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 subtraction huh? where did it go?
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant