Update: stdme/os module
This commit is contained in:
parent
dfb10f3390
commit
16f49181b5
37 changed files with 1201 additions and 345 deletions
|
|
@ -1,22 +1,23 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* str_to_i64_utils.c :+: :+: :+: */
|
||||
/* str_to_i64.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/02/01 21:15:19 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/03/07 15:24:38 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/02/01 23:18:52 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
#include "me/char/isalpha.h"
|
||||
#include "me/convert/str_to_numbers.h"
|
||||
#include "me/printf/printf.h"
|
||||
#include "me/string/str_len.h"
|
||||
#include "me/types.h"
|
||||
#include "me/printf/printf.h"
|
||||
|
||||
t_error checked_add_i64(t_i64 lhs, t_i64 rhs, t_i64 *out)
|
||||
t_error checked_add_i64(t_i64 lhs, t_i64 rhs, t_i64 *out)
|
||||
{
|
||||
if (rhs > 0 && (lhs > 9223372036854775807ll - rhs))
|
||||
return (ERROR);
|
||||
|
|
@ -24,18 +25,17 @@ t_error checked_add_i64(t_i64 lhs, t_i64 rhs, t_i64 *out)
|
|||
return (NO_ERROR);
|
||||
}
|
||||
|
||||
t_error checked_sub_i64(t_i64 lhs, t_i64 rhs, t_i64 *out)
|
||||
t_error checked_sub_i64(t_i64 lhs, t_i64 rhs, t_i64 *out)
|
||||
{
|
||||
if ((((rhs & (1 << (sizeof(t_i64) - 1)) || rhs == 0) || !true) && (lhs \
|
||||
< -(~9223372036854775807ll + 1) + rhs)))
|
||||
if ((((rhs & (1 << (sizeof(t_i64) - 1)) || rhs == 0) || !true) && (lhs < -(~9223372036854775807ll + 1) + rhs)))
|
||||
return (ERROR);
|
||||
*out = (t_i64)(lhs - rhs);
|
||||
return (NO_ERROR);
|
||||
}
|
||||
|
||||
t_error checked_mul_i64(t_i64 lhs, t_i64 rhs, t_i64 *out)
|
||||
t_error checked_mul_i64(t_i64 lhs, t_i64 rhs, t_i64 *out)
|
||||
{
|
||||
t_i64 mul;
|
||||
t_i64 mul;
|
||||
|
||||
mul = lhs * rhs;
|
||||
if (lhs != 0 && mul / lhs != rhs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue