Permalink
Browse files

Okay leggo in shitty testing

  • Loading branch information...
Adam Syed
Adam Syed committed Nov 13, 2017
1 parent fbb25e2 commit 18bfb77e87a42acc24e48ad0d3e68741835bfdf3
Showing with 26 additions and 5 deletions.
  1. +3 −3 conversions.c
  2. +2 −1 ft_printf.h
  3. +21 −1 utils.c
View
@@ -6,7 +6,7 @@
/* By: asyed <asyed@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/06 22:19:16 by asyed #+# #+# */
/* Updated: 2017/11/13 14:21:04 by asyed ### ########.fr */
/* Updated: 2017/11/13 14:36:48 by asyed ### ########.fr */
/* */
/* ************************************************************************** */
@@ -56,7 +56,7 @@ int uinteger(va_list ap, uint8_t caps, t_options *info)
num = va_arg(ap, size_t);
else
num = va_arg(ap, unsigned int);
length = u_n_length(num);
length = n_length(num);
i = info->min_width;
(info->left ? ft_uputnbr(num) : 0);
while ((__uint64_t)i-- > length)
@@ -88,7 +88,7 @@ int integer(va_list ap, uint8_t caps, t_options *info)
num = va_arg(ap, ssize_t);
else
num = va_arg(ap, int);
length = s_n_length(num);
length = n_length(num);
i = info->min_width;
(info->left ? ft_putnbr(num) : 0);
while (i-- > length)
View
@@ -6,7 +6,7 @@
/* By: asyed <asyed@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/10/21 00:32:07 by asyed #+# #+# */
/* Updated: 2017/11/13 14:19:47 by asyed ### ########.fr */
/* Updated: 2017/11/13 14:33:38 by asyed ### ########.fr */
/* */
/* ************************************************************************** */
@@ -76,6 +76,7 @@ int pointeraddr(va_list ap, uint8_t caps, t_options *info);
int octal(va_list ap, uint8_t caps, t_options *info);
/* utils.c */
size_t n_length(__int64_t n);
size_t u_n_length(__uint64_t n);
size_t s_n_length(__int64_t n);
void ft_unichar(int c, t_options *info);
View
22 utils.c
@@ -6,14 +6,34 @@
/* By: asyed <asyed@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/11/06 21:54:34 by asyed #+# #+# */
/* Updated: 2017/11/13 14:18:19 by asyed ### ########.fr */
/* Updated: 2017/11/13 14:32:42 by asyed ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdarg.h>
#include <stdio.h>
#include "ft_printf.h"
size_t n_length(__int64_t n)
{
size_t i;
i = 0;
if (!n)
return (1);
if (n < 0)
{
i++;
n = -n;
}
while (n)
{
i++;
n /= 10;
}
return (i);
}
size_t s_n_length(__int64_t n)
{
size_t i;

0 comments on commit 18bfb77

Please sign in to comment.