Skip to content

Commit

Permalink
Improve hash function in intern pool
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Oct 24, 2017
1 parent ac50733 commit 4e63a68
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/org/jboss/jandex/StrongInternPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,9 @@ public StrongInternPool() {
}

// The normal bit spreader...
private static final int hash(Object o) {
private static int hash(Object o) {
int h = o instanceof Object[] ? Arrays.hashCode((Object[])o) : o instanceof byte[] ? Arrays.hashCode((byte[])o) : o.hashCode();
h ^= (h >>> 20) ^ (h >>> 12);
return h ^ (h >>> 7) ^ (h >>> 4);
return ((h << 1 ) - (h << 8));
}

@SuppressWarnings("unchecked")
Expand Down

0 comments on commit 4e63a68

Please sign in to comment.