www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18943] New: core.internal.hash remove outdated special case

https://issues.dlang.org/show_bug.cgi?id=18943

          Issue ID: 18943
           Summary: core.internal.hash remove outdated special case for
                    DMD unaligned reads
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: n8sh.secondary hotmail.com

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.

--
Jun 04 2018