comparison lshlib.cpp @ 343:fdeb8db97678

added portable C++ reinterpret_cast<Uns32T> instead of C-style cast to fix 64-bit compile error in query.cpp. This is in advance of re-writing bucket class to include a union{} of pointer and counter fields.
author mas01mc
date Tue, 07 Oct 2008 20:08:22 +0000
parents a6edbe97fddf
children 223a5994a962
comparison
equal deleted inserted replaced
342:def30555ac89 343:fdeb8db97678
442 return *(h+j); 442 return *(h+j);
443 } 443 }
444 444
445 // Find the linked-list pointer at the end of the CORE_ARRAY 445 // Find the linked-list pointer at the end of the CORE_ARRAY
446 bucket** H::get_pointer_to_bucket_linked_list(bucket* rowPtr){ 446 bucket** H::get_pointer_to_bucket_linked_list(bucket* rowPtr){
447 Uns32T numBuckets = (Uns32T) rowPtr->snext; // Cast pointer to unsigned int 447 Uns32T numBuckets = reinterpret_cast<Uns32T> (rowPtr->snext); // Cast pointer to unsigned int
448 Uns32T numPoints = rowPtr->t2 & 0x7FFFFFFF; // Value is stored in low 31 bits of t2 field 448 Uns32T numPoints = rowPtr->t2 & 0x7FFFFFFF; // Value is stored in low 31 bits of t2 field
449 bucket** listPtr = reinterpret_cast<bucket**> (reinterpret_cast<unsigned int*>(rowPtr->next)+numPoints+numBuckets+1); 449 bucket** listPtr = reinterpret_cast<bucket**> (reinterpret_cast<unsigned int*>(rowPtr->next)+numPoints+numBuckets+1);
450 return listPtr; 450 return listPtr;
451 } 451 }
452 452
453 // Interface to Locality Sensitive Hashing G 453 // Interface to Locality Sensitive Hashing G
454 G::G(float ww, Uns32T kk,Uns32T mm, Uns32T dd, Uns32T NN, Uns32T CC, float rr): 454 G::G(float ww, Uns32T kk,Uns32T mm, Uns32T dd, Uns32T NN, Uns32T CC, float rr):
455 H(kk,mm,dd,NN,CC,ww,rr), // constructor to initialize data structures 455 H(kk,mm,dd,NN,CC,ww,rr), // constructor to initialize data structures