https://issues.apache.org/bugzilla/show_bug.cgi?id=56297
--- Comment #1 from Thomas Schodt <apa...@xenoc.demon.co.uk> --- Patch tested on linux. $ svn diff jk_map.c Index: jk_map.c =================================================================== --- jk_map.c (revision 1579918) +++ jk_map.c (working copy) @@ -36,8 +36,8 @@ #define JK_MAP_REFERENCE (".reference") #define JK_MAP_REFERENCE_SZ (strlen(JK_MAP_REFERENCE)) -/* Compute the "checksum" for a key, consisting of the first - * 4 bytes, packed into an int. +/* Compute the "checksum" for a key, consisting of + * a digest of the string (same as java hashcode). * This checksum allows us to do a single integer * comparison as a fast check to determine whether we can * skip a strcmp @@ -45,23 +45,13 @@ #define COMPUTE_KEY_CHECKSUM(key, checksum) \ { \ const char *k = (key); \ - unsigned int c = (unsigned int)*k; \ - (checksum) = c; \ - (checksum) <<= 8; \ - if (c) { \ - c = (unsigned int)*++k; \ - checksum |= c; \ + (checksum) = 0; \ + unsigned int c = (unsigned int)*k++; \ + while(c) { \ + (checksum) *= 31; \ + (checksum) += c; \ + c = (unsigned int)*k++; \ } \ - (checksum) <<= 8; \ - if (c) { \ - c = (unsigned int)*++k; \ - checksum |= c; \ - } \ - (checksum) <<= 8; \ - if (c) { \ - c = (unsigned int)*++k; \ - checksum |= c; \ - } \ } static volatile int global_map_id = 0; -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org