From 633df9239e9d692bc921ce780427409f930db7f9 Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Mon, 6 May 2024 20:59:51 +0200 Subject: [PATCH] Fix ft_mat_insert_col by switching comparison sign The function has to increase capacity in the case the matrix has insufficient capacity (not the other way around...). --- ft_arr/ft_mat_insert_col.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ft_arr/ft_mat_insert_col.c b/ft_arr/ft_mat_insert_col.c index 9b92aee..d75dae5 100644 --- a/ft_arr/ft_mat_insert_col.c +++ b/ft_arr/ft_mat_insert_col.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/12 08:57:22 by ljiriste #+# #+# */ -/* Updated: 2024/01/17 13:12:34 by ljiriste ### ########.fr */ +/* Updated: 2024/05/06 20:54:19 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -85,7 +85,7 @@ t_arr_stat ft_mat_insert_col(t_mat *mat, const t_vec *vec, size_t index) else if (mat->rows != vec->size) return (invalid_input); set_auxiliary_vars(mat, index, &cols_change, &move_index); - while ((mat->cols + cols_change) * mat->rows < mat->vec.capacity) + while ((mat->cols + cols_change) * mat->rows > mat->vec.capacity) { res = ft_vec_enlarge(&(mat->vec)); if (res != success) -- 2.30.2