Issue 15381 - Allow hashes to use only lowest bits
Summary: Allow hashes to use only lowest bits
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: druntime (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords: performance, spec
Depends on:
Blocks:
 
Reported: 2015-11-26 12:47 UTC by Denis Shelomovskii
Modified: 2024-12-07 13:35 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Denis Shelomovskii 2015-11-26 12:47:05 UTC
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
Comment 1 dlangBugzillaToGithub 2024-12-07 13:35:58 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/17317

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB