comparison src/share/vm/libadt/dict.cpp @ 562:1580954e694c

6798785: Crash in OopFlow::build_oop_map: incorrect comparison of 64bit pointers Reviewed-by: phh, kvn
author never
date Wed, 04 Feb 2009 11:44:57 -0800
parents a61af66fc99e
children 0fbdb4381b99 98cb887364d3
comparison
equal deleted inserted replaced
561:5bfdb08ea692 562:1580954e694c
344 //------------------------------Key Comparator Functions--------------------- 344 //------------------------------Key Comparator Functions---------------------
345 int32 cmpstr(const void *k1, const void *k2) { 345 int32 cmpstr(const void *k1, const void *k2) {
346 return strcmp((const char *)k1,(const char *)k2); 346 return strcmp((const char *)k1,(const char *)k2);
347 } 347 }
348 348
349 // Slimey cheap key comparator. 349 // Cheap key comparator.
350 int32 cmpkey(const void *key1, const void *key2) { 350 int32 cmpkey(const void *key1, const void *key2) {
351 return (int32)((intptr_t)key1 - (intptr_t)key2); 351 if (key1 == key2) return 0;
352 intptr_t delta = (intptr_t)key1 - (intptr_t)key2;
353 if (delta > 0) return 1;
354 return -1;
352 } 355 }
353 356
354 //============================================================================= 357 //=============================================================================
355 //------------------------------reset------------------------------------------ 358 //------------------------------reset------------------------------------------
356 // Create an iterator and initialize the first variables. 359 // Create an iterator and initialize the first variables.