diff --git a/ft_get_size.c b/ft_get_size.c index 4916c4f..cdc97bb 100644 --- a/ft_get_size.c +++ b/ft_get_size.c @@ -12,14 +12,15 @@ #include "ft_printf.h" -int ft_get_size(long n) +int ft_get_size(long long n) { long i; if (n == 0) return (1); i = 0; - n *= (n > 0) - (n < 0); + if (n < 0) + n = n * -1; while (n > 0) { i++; diff --git a/ft_putvd.c b/ft_putvd.c index 30be7cb..f795732 100644 --- a/ft_putvd.c +++ b/ft_putvd.c @@ -16,19 +16,22 @@ static int ft_putnbrhexull(unsigned long v) { int tmp; int count; + char hex[100]; count = 0; tmp = 0; - while (v > 0) + while (v != 0) { tmp = v % 16; if (tmp < 10) - ft_putchar(tmp + 48); + hex[count++] = tmp + 48; else - ft_putchar(tmp + 87); + hex[count++] = tmp + 87; v = v / 16; - count++; } + tmp = count - 1; + while (tmp >= 0) + ft_putchar(hex[tmp--]); return (count); }