Made a memory allocator (crude)
This commit is contained in:
parent
b5c7344851
commit
941bac31b6
53 changed files with 469 additions and 146 deletions
25
stdme/src/num/usize/round_up.c
Normal file
25
stdme/src/num/usize/round_up.c
Normal 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));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue