From e6d8f543af4c1a45f30495b90a3912b1c75f2be7 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 4 Nov 2019 19:24:45 +0100 Subject: Handled short convertions for unsigned int and hex --- convert_hex.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'convert_hex.c') diff --git a/convert_hex.c b/convert_hex.c index fa0d4e6..9d3ee00 100644 --- a/convert_hex.c +++ b/convert_hex.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/10/30 23:23:06 by cacharle #+# #+# */ -/* Updated: 2019/11/02 02:09:15 by cacharle ### ########.fr */ +/* Updated: 2019/11/04 19:23:28 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,7 +21,11 @@ char *convert_hex(va_list ap, t_pformat *pformat) char *tmp; long long unsigned int n; - if (pformat->flags & FLAG_LONG) + if (pformat->flags & FLAG_SHORT) + n = (unsigned short)va_arg(ap, int); + else if (pformat->flags & FLAG_SHORT_SHORT) + n = (unsigned char)va_arg(ap, int); + else if (pformat->flags & FLAG_LONG) n = va_arg(ap, long unsigned int); else if (pformat->flags & FLAG_LONG_LONG) n = va_arg(ap, long long unsigned int); -- cgit