-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_int_dec.c
39 lines (37 loc) · 1.45 KB
/
ft_int_dec.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_int_dec.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: asibille <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/14 15:53:14 by asibille #+# #+# */
/* Updated: 2022/01/14 15:53:35 by asibille ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
void ft_int_dec(int n, t_conv_flags *fl, int *size)
{
long n2;
size_t u;
int isneg;
n2 = (long) n;
isneg = 0;
if (n2 < 0)
{
n2 = -n2;
isneg = 1;
}
u = (size_t) n2;
if (fl->zero && !(fl->minus) && !(fl->ispoint))
ft_flag_plus_space_d(fl, size, isneg);
if (!fl->minus)
ft_flag_width_d(u, fl, size, isneg);
if (!(fl->zero) || fl->minus || fl->ispoint)
ft_flag_plus_space_d(fl, size, isneg);
ft_flag_point_d(u, fl, size);
if ((fl->point) || u || !(fl->ispoint))
ft_putnbr_count(u, 1, size);
if (fl->minus)
ft_flag_width_d(u, fl, size, isneg);
}