This commit is contained in:
Loic Deridder
2025-01-24 10:19:26 +01:00
parent 8dabbc426f
commit c92d92dc99
15 changed files with 1088 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lderidde <lderidde@student.s19.be> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/28 10:42:48 by lderidde #+# #+# */
/* Updated: 2024/11/04 09:23:14 by lderidde ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_fprintf.h"
int num_len(long n)
{
int i;
i = 0;
if (n < 0)
{
n *= -1;
i++;
}
while (n > 9)
{
n /= 10;
i++;
}
i++;
return (i);
}
int hex_len(unsigned long num)
{
int i;
i = 0;
while (num > 15)
{
num /= 16;
i++;
}
i++;
return (i);
}