From: Lukas Jiriste Date: Mon, 6 May 2024 18:59:51 +0000 (+0200) Subject: Fix ft_mat_insert_col by switching comparison sign X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=633df9239e9d692bc921ce780427409f930db7f9;p=Libft.git 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...). --- 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)