Made a memory allocator (crude)

This commit is contained in:
Maieul BOYER 2024-05-07 15:21:41 +02:00
parent b5c7344851
commit 941bac31b6
No known key found for this signature in database
53 changed files with 469 additions and 146 deletions

View file

@ -0,0 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* round_up.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/07 11:04:51 by maiboyer #+# #+# */
/* Updated: 2024/05/07 11:06:22 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "me/num/usize.h"
t_usize usize_round_up_to(t_usize self, t_usize mul)
{
t_usize mod;
if (mul == 0)
return (self);
mod = self % mul;
if (mod == 0)
return (self);
return (self + (mul - mod));
}