From 84705f955eac9d826776eed074684f18862446be Mon Sep 17 00:00:00 2001 From: EniumRaphael Date: Thu, 30 May 2024 16:14:32 +0200 Subject: [PATCH] Normed --- sources/operation/ft_classic_op.c | 13 ++++++------- sources/operation/ft_hard_op.c | 31 ++++++++++++++++--------------- sources/operation/operation.h | 11 +++++------ 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/sources/operation/ft_classic_op.c b/sources/operation/ft_classic_op.c index e12ade5b..631b515c 100644 --- a/sources/operation/ft_classic_op.c +++ b/sources/operation/ft_classic_op.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/30 15:33:53 by rparodi #+# #+# */ -/* Updated: 2024/05/30 16:07:58 by rparodi ### ########.fr */ +/* Updated: 2024/05/30 16:12:59 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -52,11 +52,10 @@ t_error ft_divide(t_i32 first, t_i32 second, t_i64 *result) return (NO_ERROR); } -t_error ft_modulo(t_i32 first, t_i32 second, t_i64 *result) +t_error ft_modulo(t_i32 first, t_i32 second, t_i64 *result) { - if (second == 0) { - return (ERROR); - } - *result = first % second; - return (NO_ERROR); + if (second == 0) + return (ERROR); + *result = first % second; + return (NO_ERROR); } diff --git a/sources/operation/ft_hard_op.c b/sources/operation/ft_hard_op.c index f757a8e0..528b380d 100644 --- a/sources/operation/ft_hard_op.c +++ b/sources/operation/ft_hard_op.c @@ -6,34 +6,35 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/30 15:51:55 by rparodi #+# #+# */ -/* Updated: 2024/05/30 16:04:33 by rparodi ### ########.fr */ +/* Updated: 2024/05/30 16:14:04 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ #include "operation.h" -t_error ft_power(t_i32 base, t_i32 exponent, t_i64 *result) + +t_error ft_power(t_i32 base, t_i32 exponent, t_i64 *result) { - t_i32 i; - t_i64 tmp; + t_i32 i; + t_i64 tmp; i = 0; tmp = base; if (exponent < 0) - return (ERROR); - while (i < exponent) + return (ERROR); + while (i < exponent) { - (*result) *= base; - if ((*result) / base != tmp) - return (ERROR); + (*result) *= base; + if ((*result) / base != tmp) + return (ERROR); tmp = (*result); i++; - } - return (NO_ERROR); + } + return (NO_ERROR); } -t_error ft_decrimented(t_i64 *value) +t_error ft_decrimented(t_i64 *value) { - t_i64 tmp; + t_i64 tmp; tmp = *value; (*value)--; @@ -42,9 +43,9 @@ t_error ft_decrimented(t_i64 *value) return (NO_ERROR); } -t_error ft_incrimented(t_i64 *value) +t_error ft_incrimented(t_i64 *value) { - t_i64 tmp; + t_i64 tmp; tmp = *value; (*value)++; diff --git a/sources/operation/operation.h b/sources/operation/operation.h index 7ead4484..2909f71a 100644 --- a/sources/operation/operation.h +++ b/sources/operation/operation.h @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/30 16:03:29 by rparodi #+# #+# */ -/* Updated: 2024/05/30 16:05:30 by rparodi ### ########.fr */ +/* Updated: 2024/05/30 16:14:22 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,10 +20,9 @@ t_error ft_add(t_i32 first, t_i32 second, t_i64 *result); t_error ft_subtract(t_i32 first, t_i32 second, t_i64 *result); t_error ft_multiply(t_i32 first, t_i32 second, t_i64 *result); t_error ft_divide(t_i32 first, t_i32 second, t_i64 *result); -t_error ft_modulo(t_i32 first, t_i32 second, t_i64 *result); -t_error ft_power(t_i32 base, t_i32 exponent, t_i64 *result); -t_error ft_incrimented(t_i64 *value); -t_error ft_decrimented(t_i64 *value); +t_error ft_modulo(t_i32 first, t_i32 second, t_i64 *result); +t_error ft_power(t_i32 base, t_i32 exponent, t_i64 *result); +t_error ft_incrimented(t_i64 *value); +t_error ft_decrimented(t_i64 *value); #endif -