Compare commits

..

No commits in common. "master" and "malloc-dementor-reload-2025-12-20-1" have entirely different histories.

View file

@ -41,10 +41,8 @@ int find_free_block(struct bucket *buck)
return -1;
}
size_t num_blocks_in_page =
(PAGE_SIZE - sizeof(struct bucket)) / buck->block_size;
size_t maplength = (num_blocks_in_page + 7)
/ 8; // +7 for ceiling division (oui c'est moche mais ça marche)
size_t num_blocks_in_page = (PAGE_SIZE - sizeof(struct bucket)) / buck->block_size;
size_t maplength = (num_blocks_in_page + 7) / 8; // +7 for ceiling division (oui c'est moche mais ça marche)
// Foreach byte
for (unsigned i = 0; i < maplength; i++)
@ -55,8 +53,7 @@ int find_free_block(struct bucket *buck)
for (unsigned j = 0; j < 8; j++)
{
if ((i * 8 + j) < num_blocks_in_page
&& !(map_byte & (1 << j))) // Check if free
if ((i * 8 + j) < num_blocks_in_page && !(map_byte & (1 << j))) // Check if free
return i * 8 + j;
}
}
@ -81,8 +78,7 @@ int get_block_number(struct bucket *biquette, void *block)
return -1;
char *block_nul = block;
char *bibiche =
get_data_begin(biquette); // Célèbre bar Capcinois, venez à l'occasion
char* bibiche = get_data_begin(biquette); // Célèbre bar Capcinois, venez à l'occasion
return (block_nul - bibiche) / biquette->block_size;
@ -95,6 +91,7 @@ int get_block_number(struct bucket *biquette, void *block)
// return (block_nul - biquette_cherie - sizeof(struct bucket))
// / biquette->block_size;
}
// Gets a bucket with at least a block_size of size