summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/Reference.java
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2012-08-10 19:05:05 +0200
committerJose <jose@zeroc.com>2012-08-10 19:05:05 +0200
commitdac1de9cee466c49bb66d1fa3ff3e7f8ce74b41d (patch)
treee21599db79868ffc65be32b4dda2056af9e18b0b /java/src/IceInternal/Reference.java
parentRemove some more VC6 compiler fixes (diff)
downloadice-dac1de9cee466c49bb66d1fa3ff3e7f8ce74b41d.tar.bz2
ice-dac1de9cee466c49bb66d1fa3ff3e7f8ce74b41d.tar.xz
ice-dac1de9cee466c49bb66d1fa3ff3e7f8ce74b41d.zip
ICE-4702 - Poor hash algorithm
Diffstat (limited to 'java/src/IceInternal/Reference.java')
-rw-r--r--java/src/IceInternal/Reference.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/java/src/IceInternal/Reference.java b/java/src/IceInternal/Reference.java
index 8a1357d8401..2e6e1f4af1a 100644
--- a/java/src/IceInternal/Reference.java
+++ b/java/src/IceInternal/Reference.java
@@ -201,20 +201,23 @@ public abstract class Reference implements Cloneable
return _hashValue;
}
- int h = _mode;
-
- h = 5 * h + _identity.hashCode();
-
- h = 5 * h + _context.hashCode();
-
- h = 5 * h + _facet.hashCode();
-
- h = 5 * h + (_secure ? 1 : 0);
+ int h = 5381;
+ h = IceInternal.HashUtil.hashAdd(h, _mode);
+ h = IceInternal.HashUtil.hashAdd(h, _secure);
+ h = IceInternal.HashUtil.hashAdd(h, _identity);
+ h = IceInternal.HashUtil.hashAdd(h, _context);
+ h = IceInternal.HashUtil.hashAdd(h, _facet);
+ h = IceInternal.HashUtil.hashAdd(h, _overrideCompress);
+ if(_overrideCompress)
+ {
+ h = IceInternal.HashUtil.hashAdd(h, _compress);
+ }
+ h = IceInternal.HashUtil.hashAdd(h, _encoding);
_hashValue = h;
_hashInitialized = true;
- return h;
+ return _hashValue;
}
//