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

Allow hashes to use only lowest bits #17317

Open
dlangBugzillaToGithub opened this issue Nov 26, 2015 · 0 comments
Open

Allow hashes to use only lowest bits #17317

dlangBugzillaToGithub opened this issue Nov 26, 2015 · 0 comments
Labels

Comments

@dlangBugzillaToGithub
Copy link

Denis Shelomovskii (@denis-sh) reported this on 2015-11-26T12:47:05Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=15381

Description

It's a common situation that hash tables and other algorithms use only some bits of a hash so all hash bits must equally represent the object (currently not documented, filled as Issue 15380).

It may be useful to require an algorithm working with hashes cut only highest bits (as current Druntime's associative array implementation does). This allows e.g. unique indexed elements use its index as a hash (if I'm not missing something regarding probabilities of usage patterns):

  size_t toHash() { return myIndex; } // Will be allowed
@thewilsonator thewilsonator added Severity:Enhancement Druntime Specific to druntime and removed enhancement labels Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants