[Issue 15381] New: Allow hashes to use only lowest bits
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Nov 26 04:47:05 PST 2015
https://issues.dlang.org/show_bug.cgi?id=15381
Issue ID: 15381
Summary: Allow hashes to use only lowest bits
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: performance, spec
Severity: enhancement
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: verylonglogin.reg at gmail.com
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
--
More information about the Digitalmars-d-bugs
mailing list