Bug 18943 – core.internal.hash remove outdated special case for DMD unaligned reads
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2018-06-05T05:12:11Z
Last change time
2018-06-10T18:10:31Z
Assigned to
No Owner
Creator
Nathan S.
Comments
Comment #0 by n8sh.secondary — 2018-06-05T05:12:11Z
core.internal.hash has lines dating back to its initial commit on November 16, 2013 that disable unaligned reads when using DMD comment that a DMD bug would prevent inlining. That is not true in the present day so the comment and alternative code branch have no purpose except to confuse.
With optimization enabled DMD produces the same code for
`return *cast(uint*)x;`
and
`return ((cast(uint) x[3]) << 24) | ((cast(uint) x[2]) << 16) | ((cast(uint) x[1]) << 8) | (cast(uint) x[0]);`
when `x` is `ubyte*`, so this patch is not expected to improve performance except for non-optimized builds.
Comment #1 by n8sh.secondary — 2018-06-05T05:23:02Z