-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_handle_hex.c
More file actions
40 lines (35 loc) · 1.22 KB
/
Copy pathft_handle_hex.c
File metadata and controls
40 lines (35 loc) · 1.22 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_handle_hex.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mohaben- <mohaben-@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/27 10:44:18 by mohaben- #+# #+# */
/* Updated: 2024/11/27 11:56:50 by mohaben- ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
int ft_len_hex(unsigned int n)
{
int len;
if (n == 0)
return (1);
len = 0;
while (n != 0)
{
n /= 16;
len++;
}
return (len);
}
int ft_handle_len_hex(unsigned int n, t_flags flag)
{
int len;
len = ft_len_hex(n);
if (flag.precision > len)
len = flag.precision;
if (flag.hash && n)
len += 2;
return (len);
}