hotspot/src/share/vm/libadt/dict.cpp
changeset 2026 d15da7324f58
parent 1 489c9b5090e2
child 2131 98f9cef66a34
child 2105 347008ce7984
--- a/hotspot/src/share/vm/libadt/dict.cpp	Tue Feb 03 18:05:19 2009 -0800
+++ b/hotspot/src/share/vm/libadt/dict.cpp	Wed Feb 04 11:44:57 2009 -0800
@@ -346,9 +346,12 @@
   return strcmp((const char *)k1,(const char *)k2);
 }
 
-// Slimey cheap key comparator.
+// Cheap key comparator.
 int32 cmpkey(const void *key1, const void *key2) {
-  return (int32)((intptr_t)key1 - (intptr_t)key2);
+  if (key1 == key2) return 0;
+  intptr_t delta = (intptr_t)key1 - (intptr_t)key2;
+  if (delta > 0) return 1;
+  return -1;
 }
 
 //=============================================================================