diff options
Diffstat (limited to 'src/b_sqb_nbr.c')
-rw-r--r-- | src/b_sqb_nbr.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/b_sqb_nbr.c b/src/b_sqb_nbr.c new file mode 100644 index 0000000..6ea2456 --- /dev/null +++ b/src/b_sqb_nbr.c @@ -0,0 +1,45 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* b_sqb_nbr.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include <stdint.h> + +#include "d_define.h" + +static t_bool + b_sqb_nbr_tests(uint8_t id, + int32_t n1, + int32_t n2) +{ + if (id == FT_ID_SQB_EQ && n1 == n2) + return (TRUE); + else if (id == FT_ID_SQB_NE && n1 != n2) + return (TRUE); + else if (id == FT_ID_SQB_GT && n1 > n2) + return (TRUE); + else if (id == FT_ID_SQB_GE && n1 >= n2) + return (TRUE); + else if (id == FT_ID_SQB_LT && n1 < n2) + return (TRUE); + else if (id == FT_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); +} |