Removed pointless 8-char optimization.

Now it is more useful for this to hash identically as in Java.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5753 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2009-04-28 01:14:01 +00:00
parent 9a50e5f791
commit e7dbda821d
+3 -4
View File
@@ -44,10 +44,9 @@ public class StringUtil
{ {
var code :int = 0; var code :int = 0;
if (str != null) { if (str != null) {
// sample at most 8 chars // hash identically to Java's String.hashCode(), for various reasons
var lastChar :int = Math.min(8, str.length); for (var ii :int = 0; ii < str.length; ii++) {
for (var ii :int = 0; ii < lastChar; ii++) { code = 31 * code + str.charCodeAt(ii);
code = code * 31 + str.charCodeAt(ii);
} }
} }
return code; return code;