| Line | Branch | Exec | Source | 
|---|---|---|---|
| 1 | /* | ||
| 2 | ** EPITECH PROJECT, 2023 | ||
| 3 | ** my_printf | ||
| 4 | ** File description: | ||
| 5 | ** The functions for apply an specifier on an int | ||
| 6 | */ | ||
| 7 | /** | ||
| 8 | * @file specifier_int.c | ||
| 9 | * @brief The file containing the specifier_int function | ||
| 10 | * @author Nicolas TORO | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include "myprintf.h" | ||
| 14 | |||
| 15 | 11 | static char *select_long_long(size_t temp) | |
| 16 | { | ||
| 17 | 11 | return my_str_nbr_long_long(temp); | |
| 18 | } | ||
| 19 | |||
| 20 | 4 | static char *select_short(size_t temp) | |
| 21 | { | ||
| 22 | 4 | return my_str_nbr_short((short int)temp); | |
| 23 | } | ||
| 24 | |||
| 25 | 4 | static char *select_short_short(size_t temp) | |
| 26 | { | ||
| 27 | 4 | return my_str_nbr_short_short((signed char)temp); | |
| 28 | } | ||
| 29 | |||
| 30 | 1 | static char *select_size_t(size_t temp) | |
| 31 | { | ||
| 32 | 1 | return my_str_nbr_size_t(temp); | |
| 33 | } | ||
| 34 | |||
| 35 | 54 | char *specify_it_int(formating_t *formating, size_t temp) | |
| 36 | { | ||
| 37 | 54 | char *(*specify[])(size_t) = {&select_long_long, &select_long_long, | |
| 38 | &select_short, &select_short_short, &select_size_t, | ||
| 39 | &select_size_t, &select_size_t, &select_size_t}; | ||
| 40 | |||
| 41 | 2/2✓ Branch 0 taken 20 times. ✓ Branch 1 taken 34 times. | 54 | if (formating->id_sp != -1) { | 
| 42 | 20 | return specify[formating->id_sp](temp); | |
| 43 | } else { | ||
| 44 | 34 | return my_str_nbr(temp); | |
| 45 | } | ||
| 46 | } | ||
| 47 |