Skip to content

Commit

Permalink
[Truffle] Update Fixnum/Complex#hash specializations
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Fish committed Sep 15, 2016
1 parent 93cc335 commit 7ddb76a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
Expand Up @@ -899,15 +899,15 @@ public abstract static class HashNode extends CoreMethodArrayArgumentsNode {

@Specialization
public long hash(int value) {
long h = Helpers.hashStart(getContext().getJRubyRuntime(), value);
h = Helpers.murmurCombine(h, MURMUR_ARRAY_SEED);
long h = Helpers.hashStart(getContext().getJRubyRuntime(), MURMUR_ARRAY_SEED);

This comment has been minimized.

Copy link
@eregon

eregon Sep 15, 2016

Member

Maybe just MURMUR_SEED?

This comment has been minimized.

Copy link
@bjfish

bjfish Sep 15, 2016

Contributor

Fixed: ac60bbe

h = Helpers.murmurCombine(h, value);
return Helpers.hashEnd(h);
}

@Specialization
public long hash(long value) {
long h = Helpers.hashStart(getContext().getJRubyRuntime(), value);
h = Helpers.murmurCombine(h, MURMUR_ARRAY_SEED);
long h = Helpers.hashStart(getContext().getJRubyRuntime(), MURMUR_ARRAY_SEED);
h = Helpers.murmurCombine(h, value);
return Helpers.hashEnd(h);
}

Expand Down
Expand Up @@ -1188,23 +1188,6 @@ public DynamicObject coerce(int a, Object b) {
@Primitive(name = "fixnum_memhash")
public static abstract class FixnumMemhashPrimitiveNode extends PrimitiveArrayArgumentsNode {


@Specialization
public long memhashIntInt(int a, int b) {
return memhashLongLong((long) a, (long) b);
}

@Specialization
public long memhashLongInt(long a, int b) {
return memhashLongLong(a, (long) b);
}

@Specialization
public long memhash(int a, long b) {
return memhashLongLong((long) a, b);
}


@Specialization
public long memhashLongLong(long a, long b) {
final ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES * 2);
Expand Down

0 comments on commit 7ddb76a

Please sign in to comment.