Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** specifier int | ||
4 | ** File description: | ||
5 | ** specifier int | ||
6 | */ | ||
7 | |||
8 | #include "my.h" | ||
9 | #include "myformats.h" | ||
10 | |||
11 | 2 | static char *select_long_long(size_t temp, char *base) | |
12 | { | ||
13 | 2 | return my_str_nbr_base_unsigned_long((long)temp, base); | |
14 | } | ||
15 | |||
16 | 1 | static char *select_short(size_t temp, char *base) | |
17 | { | ||
18 | 1 | return my_str_nbr_base_unsigned_short((unsigned short)temp, base); | |
19 | } | ||
20 | |||
21 | 1 | static char *select_short_short(size_t temp, char *base) | |
22 | { | ||
23 | 1 | return my_str_nbr_base_unsigned_short_short((unsigned char)temp, base); | |
24 | } | ||
25 | |||
26 | 1 | static char *select_size_t(size_t temp, char *base) | |
27 | { | ||
28 | 1 | return my_str_nbr_base_unsigned_size_t(temp, base); | |
29 | } | ||
30 | |||
31 | 59 | char *specify_it_base(formating_t *formating, size_t temp, char *base) | |
32 | { | ||
33 | 59 | char *(*specify[])(size_t, char *) = | |
34 | {&select_long_long, &select_long_long, | ||
35 | &select_short, &select_short_short, &select_size_t, | ||
36 | &select_size_t, &select_size_t, &select_size_t}; | ||
37 | |||
38 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 54 times.
|
59 | if (formating->id_sp != -1) { |
39 | 5 | return specify[formating->id_sp](temp, base); | |
40 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 43 times.
|
54 | } else if (formating->flag == 'b') { |
41 | 11 | return my_convert_base_unsigned(my_str_nbr_unsigned(temp), | |
42 | "0123456789", "01"); | ||
43 | } else { | ||
44 | 43 | return my_str_nbr_base_unsigned((unsigned)temp, base); | |
45 | } | ||
46 | } | ||
47 |