/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* b_sqb_nbr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ /* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ /* */ /* ************************************************************************** */ #include #include #include "d_define.h" static t_bool b_sqb_nbr_tests(uint8_t id, int32_t n1, int32_t n2) { if (id == B_ID_SQB_EQ && n1 == n2) return (TRUE); else if (id == B_ID_SQB_NE && n1 != n2) return (TRUE); else if (id == B_ID_SQB_GT && n1 > n2) return (TRUE); else if (id == B_ID_SQB_GE && n1 >= n2) return (TRUE); else if (id == B_ID_SQB_LT && n1 < n2) return (TRUE); else if (id == B_ID_SQB_LE && n1 <= n2) return (TRUE); return (FALSE); } uint8_t b_sqb_nbr(uint8_t id, char *argv[]) { if (b_sqb_nbr_tests(id, ft_atoi(argv[0]), ft_atoi(argv[2])) == TRUE) return (0); return (1); }