Adding the norm for maiboyerlpb lib

This commit is contained in:
Raphael (rparodi) 2024-07-30 16:15:01 +02:00
parent b693536a90
commit 41589a8a42
16 changed files with 97 additions and 2376 deletions

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/16 17:57:04 by maiboyer #+# #+# */
/* Updated: 2024/07/18 13:21:06 by maiboyer ### ########.fr */
/* Updated: 2024/07/30 16:10:07 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,7 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
t_i32 _atoi_printf(t_const_str s);
t_i32 _atoi_printf(t_const_str s);
bool handle_atoi_stuff(t_const_str fmt, t_usize *c_idx, t_usize *nxt,
t_printf_arg *c_arg)

View file

@ -6,7 +6,7 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/16 18:06:15 by maiboyer #+# #+# */
/* Updated: 2024/07/18 13:20:35 by maiboyer ### ########.fr */
/* Updated: 2024/07/30 16:11:00 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -53,25 +53,25 @@ void print_sign_if_needed(t_pad_and_stuff_args a, t_printf_arg d,
f(a.sign, a.sign_len, d.p_args);
}
t_i32 _atoi_printf(t_const_str str)
t_i32 _atoi_printf(t_const_str str)
{
t_u64 out;
t_u64 sign;
t_usize i;
t_u64 out;
t_u64 sign;
t_usize i;
out = 0;
i = 0;
sign = 1;
while (me_isspace(str[i]))
i++;
if (str[i] == '+' || str[i] == '-')
if (str[i++] == '-')
sign = -1;
while (me_isdigit(str[i]))
{
out *= 10;
out += str[i] - '0';
i++;
}
return ((t_i32)(out * sign));
out = 0;
i = 0;
sign = 1;
while (me_isspace(str[i]))
i++;
if (str[i] == '+' || str[i] == '-')
if (str[i++] == '-')
sign = -1;
while (me_isdigit(str[i]))
{
out *= 10;
out += str[i] - '0';
i++;
}
return ((t_i32)(out * sign));
}