-
-
Notifications
You must be signed in to change notification settings - Fork 421
core.internal.hash.bytesHash: in 64-bit builds use a 64-bit-oriented algorithm #3148
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request, @n8sh! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + druntime#3148" |
b28789a
to
077c6dc
Compare
Test runnable/testaa2.d failed:
expected:
----
foo()
foo() 2
foo() 3
foo() 4
c["foo"] = 3
c["bar"] = 4
Success
----
actual:
----
foo()
foo() 2
foo() 3
foo() 4
c["bar"] = 4
c["foo"] = 3
Success A DMD test is failing because it depends on a specific AA traversal order. I am inclined to consider that erroneous based on https://dlang.org/spec/hash-map.html:
|
Indeed. This test should be fixed. |
24e4042
to
4b0e672
Compare
Please add a reference for this hash algorithm in a comment |
src/core/internal/hash.d
Outdated
version (BigEndian) | ||
{ | ||
auto k1 = | ||
((cast(ulong) data[0]) << 56) | | ||
((cast(ulong) data[1]) << 48) | | ||
((cast(ulong) data[2]) << 40) | | ||
((cast(ulong) data[3]) << 32) | | ||
((cast(ulong) data[4]) << 24) | | ||
((cast(ulong) data[5]) << 16) | | ||
((cast(ulong) data[6]) << 8) | | ||
(cast(ulong) data[7]); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this use the pointer read optimization as done for the 32 bit hash above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it does.
35ad7df
to
2fba8d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@n8sh maybe a rebase will fix the current failures.
…a 64-bit-oriented algorithm
Motivation: doesn't discard high 32 bits of seed; produces 64 bits of output; and is a bit faster.