- frag_pointed1 = ((char *)address_pointed1 - (char *)((void*) (((ADDR2UINT((size_t)block_pointed1)) - 1) * BLOCKSIZE + (char*)((struct mdesc*)s_heap)->heapbase))) / pow( 2, mdp1->heapinfo[block_pointed1].type);
- frag_pointed2 = ((char *)address_pointed2 - (char *)((void*) (((ADDR2UINT((size_t)block_pointed2)) - 1) * BLOCKSIZE + (char*)((struct mdesc*)s_heap)->heapbase))) / pow( 2, mdp1->heapinfo[block_pointed1].type);
+ frag_pointed1 = ((uintptr_t) (ADDR2UINT (address_pointed1) % (BLOCKSIZE))) >> mdp1->heapinfo[i].type;
+ frag_pointed2 = ((uintptr_t) (ADDR2UINT (address_pointed2) % (BLOCKSIZE))) >> mdp1->heapinfo[i].type;