Bug 15381 – Allow hashes to use only lowest bits

Status
NEW
Severity
enhancement
Priority
P4
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-11-26T12:47:05Z
Last change time
2024-12-07T13:35:58Z
Keywords
performance, spec
Assigned to
No Owner
Creator
Denis Shelomovskii
Moved to GitHub: dmd#17317 →

Comments

Comment #0 by verylonglogin.reg — 2015-11-26T12:47:05Z
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 by robert.schadek — 2024-12-07T13:35:58Z
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