- /* FIXME : peut pointer vers le début d'un fragment mais dans un bloc */
- fprintf(stderr, "Pointed addresses (%p - %p) not valid\n", address_pointed1, address_pointed2);
- distance++;
+ block_pointed1 = ((char*)address_pointed1 - (char*)((struct mdesc*)s_heap)->heapbase) / BLOCKSIZE + 1;
+ block_pointed2 = ((char*)address_pointed2 - (char*)((struct mdesc*)s_heap)->heapbase) / BLOCKSIZE + 1;
+ if((mdp1->heapinfo[block_pointed1].type == mdp2->heapinfo[block_pointed2].type) && (mdp1->heapinfo[block_pointed1].type > 0)){
+ addr_block_pointed1 = (char*)((struct mdesc*)s_heap)->heapbase + ((block_pointed1 - 1)*BLOCKSIZE);
+ addr_block_pointed2 = (char*)((struct mdesc*)s_heap)->heapbase + ((block_pointed2 - 1)*BLOCKSIZE);
+ frag_size_pointed = pow (2,mdp1->heapinfo[block_pointed1].type);
+ if((((char*)address_pointed1 - (char*)addr_block_pointed1) % frag_size_pointed == 0) && (((char*)address_pointed2 - (char*)addr_block_pointed2) % frag_size_pointed == 0)){
+ addr_frag_pointed1 = (char *)heapbase1 + ((char*)address_pointed1 - (char*)((struct mdesc*)s_heap)->heapbase);
+ addr_frag_pointed2 = (char *)heapbase2 + ((char*)address_pointed2 - (char*)((struct mdesc*)s_heap)->heapbase);
+ if(memcmp(addr_frag_pointed1, addr_frag_pointed2, frag_size_pointed) != 0){
+ distance++;
+ }else{
+ fprintf(stderr, "False difference detected\n");
+ fflush(NULL);
+ }
+ }else{
+ fprintf(stderr, "Pointed addresses (%p - %p) not valid \n", address_pointed1, address_pointed2);
+ fflush(NULL);
+ distance++;
+ }
+ }else{
+ fprintf(stderr, "Pointed addresses (%p - %p) not valid \n", address_pointed1, address_pointed2);
+ fflush(NULL);
+ distance++;
+ }