Commit 7f157ab8 authored by Hugo's avatar Hugo
Browse files

partir 1 fait

parent 9d9d3fc6
......@@ -37,21 +37,20 @@ void *mark_memarea_and_get_user_ptr(void *ptr, unsigned long size, MemKind k)
mark_check_and_get_alloc(void *ptr)
//creation de variables et on recupere le magique
Alloc a = {};
char* pointeur = (char*)ptr -16;
char* pointeur = (char*)ptr -16;//pointeur pointe vers l'octet du debut de marquage du debut
uint64_t magicLu = *(unsigned long *)(pointeur+8);
//on renseigne les valeurs de a a retourner
a.ptr = (void*)pointeur;
a.size = *(unsigned long*)a.ptr;
a.kind = (MemKind)magicLu;
a.size = *(unsigned long*)(pointeur);
uint64_t magique = knuth_mmix_one_round((unsigned long)pointeur) & ~(0b11UL);
a.kind = *(MemKind*)magique;
uint64_t magic;
magic = knuth_mmix_one_round((unsigned long)a.size) & ~(0b11UL);*/
// assert(magic == *((uint64_t*)(ptr+a.size))) ;
// assert(*((uint64_t*)(ptr-16))==*((uint64_t*)(ptr+a.size+8)));
// assert(*((uint64_t*)(ptr-8))==*((uint64_t*)(ptr+a.size)));
uint64_t magicParCalcul = knuth_mmix_one_round((unsigned long)((void*)pointeur)) & ~(0b11UL);
assert(magicLu == magicParCalcul) ;//verifie magic
char* pointeur2 = (char*)(pointeur+a.size-16);//pointeur2 pointe vers l'octet du debut de marquage de fin
assert(*((unsigned long *)(pointeur))== *((unsigned long *)(pointeur2+8)));//verifie marquage debut = marquage fin
assert(*((unsigned long *)(pointeur+8))== *((unsigned long *)(pointeur2)));
return a;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment