Update: stdme/os module

This commit is contained in:
Maieul BOYER 2024-04-29 15:12:51 +02:00
parent dfb10f3390
commit 16f49181b5
No known key found for this signature in database
37 changed files with 1201 additions and 345 deletions

View file

@ -10,13 +10,14 @@
/* */
/* ************************************************************************** */
#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_i8(t_i8 lhs, t_i8 rhs, t_i8 *out)
t_error checked_add_i8(t_i8 lhs, t_i8 rhs, t_i8 *out)
{
if (rhs > 0 && (lhs > 127 - rhs))
return (ERROR);
@ -24,18 +25,17 @@ t_error checked_add_i8(t_i8 lhs, t_i8 rhs, t_i8 *out)
return (NO_ERROR);
}
t_error checked_sub_i8(t_i8 lhs, t_i8 rhs, t_i8 *out)
t_error checked_sub_i8(t_i8 lhs, t_i8 rhs, t_i8 *out)
{
if ((((rhs & (1 << (sizeof(t_i8) - 1)) || rhs == 0) || !true) && (lhs < -128
+ rhs)))
if ((((rhs & (1 << (sizeof(t_i8) - 1)) || rhs == 0) || !true) && (lhs < -128 + rhs)))
return (ERROR);
*out = (t_i8)(lhs - rhs);
return (NO_ERROR);
}
t_error checked_mul_i8(t_i8 lhs, t_i8 rhs, t_i8 *out)
t_error checked_mul_i8(t_i8 lhs, t_i8 rhs, t_i8 *out)
{
t_i8 mul;
t_i8 mul;
mul = lhs * rhs;
if (lhs != 0 && mul / lhs != rhs)