}
//Store objects and their pointers into hash
-INLINE void cInsert(ctable_t *table, unsigned int key, void *val) {
+INLINE void cInsert(ctable_t *table, void * key, void *val) {
unsigned int newsize;
int index;
cnode_t *ptr, *node;
- ptr = &table->table[(key & table->mask)>>2];
+ ptr = &table->table[(((unsigned int)key) & table->mask)>>2];
if (ptr->key==0) {
ptr->key=key;
ptr->val=val;
}
// Search for an address for a given oid
-INLINE void * cSearch(ctable_t *table, unsigned int key) {
+INLINE void * cSearch(ctable_t *table, void * key) {
//REMOVE HASH FUNCTION CALL TO MAKE SURE IT IS INLINED HERE
- cnode_t *node = &table->table[(key & table->mask)>>2];
+ cnode_t *node = &table->table[(((unsigned int)key) & table->mask)>>2];
while(node != NULL) {
if(node->key == key) {
return NULL;
}
-unsigned int cRemove(ctable_t *table, unsigned int key) {
+unsigned int cRemove(ctable_t *table, void * key) {
int index;
cnode_t *curr, *prev;
cnode_t *ptr, *node;
ptr = table->table;
- index =(key & table->mask)>>2;
+ index =(((unsigned int)key) & table->mask)>>2;
curr = &ptr[index];
for (; curr != NULL; curr = curr->next) {
continue;
while(curr!=NULL) {
cnode_t * next = curr->next;
- int index =(curr->key & mask)>>2;
+ int index =(((unsigned int)curr->key) & mask)>>2;
cnode_t * newnode=&ntable[index];
if(newnode->key==0) {
for(i=0; i<numparams; i++) {
void * objptr=srcpointer[i];
void *dst;
- if ((dst=cSearch(forward, (int) objptr))!=NULL)
+ if ((dst=cSearch(forward, objptr))!=NULL)
newarray[i]=dst;
else {
void * copy=createcopy(objptr);
- cInsert(forward, (int) objptr, copy);
- cInsert(reverse, (int) copy, objptr);
+ cInsert(forward, objptr, copy);
+ cInsert(reverse, copy, objptr);
addNewItem(todo, objptr);
newarray[i]=copy;
}
{
void *cpy;
unsigned int * pointer=NULL;
- cpy=cSearch(forward, (unsigned int)ptr);
+ cpy=cSearch(forward, ptr);
pointer=pointerarray[type];
#ifdef TASK
void *objptr=((struct ___TagDescriptor___*)ptr)->flagptr;
if (objptr!=NULL) {
void *dst;
- if ((dst=cSearch(forward, (unsigned int)objptr))==NULL) {
+ if ((dst=cSearch(forward, objptr))==NULL) {
void *copy=createcopy(objptr);
- cInsert(forward, (int) objptr, copy);
- cInsert(reverse, (int) copy, objptr);
+ cInsert(forward, objptr, copy);
+ cInsert(reverse, copy, objptr);
addNewItem(todo, objptr);
((struct ___TagDescriptor___*)cpy)->flagptr=copy;
} else {
void *objptr=((void **)(((char *)&ao->___length___)+sizeof(int)))[i];
if (objptr==NULL) {
((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]=NULL;
- } else if ((dst=cSearch(forward, (int)objptr))!=NULL)
+ } else if ((dst=cSearch(forward,objptr))!=NULL)
((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]=dst;
else {
void * copy=createcopy(objptr);
- cInsert(forward, (int) objptr, copy);
- cInsert(reverse, (int) copy, objptr);
+ cInsert(forward, objptr, copy);
+ cInsert(reverse, copy, objptr);
addNewItem(todo, objptr);
((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]=copy;
}
void *dst;
if (objptr==NULL) {
*((void **)(((int)cpy)+offset))=NULL;
- } else if ((dst=cSearch(forward, (unsigned int)objptr))!=NULL)
+ } else if ((dst=cSearch(forward, objptr))!=NULL)
*((void **) &(((char *)cpy)[offset]))=dst;
else {
void * copy=createcopy(objptr);
- cInsert(forward, (int) objptr, copy);
- cInsert(reverse, (int) copy, objptr);
+ cInsert(forward, objptr, copy);
+ cInsert(reverse, copy, objptr);
addNewItem(todo, objptr);
*((void **)(((int)cpy)+offset))=copy;
}
for(i=0; i<numparams; i++) {
if (checkpoint[i]!=NULL) {
addNewItem(todo, checkpoint[i]);
- cInsert(visited, (unsigned int) checkpoint[i], checkpoint[i]);
+ cInsert(visited, checkpoint[i], checkpoint[i]);
}
}
void *cpy;
unsigned int *pointer;
int size;
- cpy=cSearch(reverse, (int) ptr);
+ cpy=cSearch(reverse, ptr);
pointer=pointerarray[type];
size=classsize[type];
#ifdef TASK
void *objptr=((struct ___TagDescriptor___*)ptr)->flagptr;
memcpy(cpy, ptr, size);
if (objptr!=NULL) {
- if (cSearch(visited, (unsigned int)objptr)==NULL) {
- cInsert(visited, (int) objptr, objptr);
+ if (cSearch(visited, objptr)==NULL) {
+ cInsert(visited, objptr, objptr);
addNewItem(todo, objptr);
}
- *((void **) &(((struct ___TagDescriptor___ *)cpy)->flagptr))=cSearch(reverse, (int) objptr);
+ *((void **) &(((struct ___TagDescriptor___ *)cpy)->flagptr))=cSearch(reverse, objptr);
}
} else
#endif
if (objptr==NULL)
((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]=NULL;
else {
- if (cSearch(visited, (int) objptr)==NULL) {
- cInsert(visited, (int) objptr, objptr);
+ if (cSearch(visited, objptr)==NULL) {
+ cInsert(visited, objptr, objptr);
addNewItem(todo, objptr);
}
- *((void **) &((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i])=cSearch(reverse, (int) objptr);
+ *((void **) &((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i])=cSearch(reverse, objptr);
}
}
} else {
if (objptr==NULL)
*((void **)(((int)cpy)+offset))=NULL;
else {
- if (cSearch(visited, (int)objptr)==NULL) {
- cInsert(visited, (int) objptr, objptr);
+ if (cSearch(visited, objptr)==NULL) {
+ cInsert(visited, objptr, objptr);
addNewItem(todo, objptr);
}
- *((void **) &(((char *)cpy)[offset]))=cSearch(reverse, (int) objptr);
+ *((void **) &(((char *)cpy)[offset]))=cSearch(reverse, objptr);
}
}
if (hasflags[type]) {