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

Use Type Aliases for DoubleWidth Digests #27

Closed
crichez opened this issue Feb 3, 2022 · 0 comments · Fixed by #28
Closed

Use Type Aliases for DoubleWidth Digests #27

crichez opened this issue Feb 3, 2022 · 0 comments · Fixed by #28
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@crichez
Copy link
Owner

crichez commented Feb 3, 2022

Overview

Digests 128 bits wide and larger should have type aliases to erase the DoubleWidth nesting.

Proposal

public typealias Digest128 = DoubleWidth<UInt64>
public typealias Digest256 = DoubleWidth<Digest128>
public typealias Digest512 = DoubleWidth<Digest256>
public typealias Digest1024 = DoubleWidth<Digest512>

Alternatives

This was originally omitted to make the DoubleWidth nesting as obvious as possible, since it is not a recommended practice and significantly degrades performance. However the same goal can be achieved through better documentation of each type alias without affecting code clarity.

@crichez crichez added documentation Improvements or additions to documentation enhancement New feature or request labels Feb 3, 2022
@crichez crichez self-assigned this Feb 3, 2022
@crichez crichez changed the title Use Type Aliases for DoubleWidth Digests Use Type Aliases for DoubleWidth Digests Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant