blob: 0f96e82183080df83eac7f1adae1dc0ae9a29c4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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 == 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);
}
|