Commit b18cf811 authored by Jules Sang's avatar Jules Sang
Browse files

2 new tests pass

parent a59502e8
......@@ -17,14 +17,13 @@ unsigned long knuth_mmix_one_round(unsigned long in)
void *mark_memarea_and_get_user_ptr(void *ptr, unsigned long size, MemKind k)
{
unsigned long magic_number = knuth_mmix_one_round((unsigned long) ptr);
magic_number = magic_number & ~(0b11UL);
magic_number = magic_number | k;
*((unsigned long*) ptr) = size;
*((unsigned long*) (ptr + 1)) = magic_number;
*((unsigned long*) (ptr + size/8 - 1)) = magic_number;
*((unsigned long*) (ptr + size/8 - 2)) = size;
return ptr + 2;
unsigned long magic_number = (knuth_mmix_one_round((unsigned long) ptr) & ~(0b11UL)) | k;
((unsigned long*) ptr)[0] = size;
((unsigned long*) (ptr))[1] = magic_number;
((unsigned long*) (ptr))[(size/8)-1] = magic_number;
((unsigned long*) (ptr))[size/8 - 2] = size;
// changed from + 2 to + 16 because taille + magic = 8B != 8b
return ptr + 16;
}
Alloc
......
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