aboutsummaryrefslogtreecommitdiff
path: root/convert_hex.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-11-04 19:24:45 +0100
committerCharles <sircharlesaze@gmail.com>2019-11-04 19:24:45 +0100
commite6d8f543af4c1a45f30495b90a3912b1c75f2be7 (patch)
tree3654b9df8d7bb3c341218f901712bdb257d7d486 /convert_hex.c
parenteca117f28afac2ee258d9e9454ff63c6dec5b58f (diff)
downloadft_printf-e6d8f543af4c1a45f30495b90a3912b1c75f2be7.tar.gz
ft_printf-e6d8f543af4c1a45f30495b90a3912b1c75f2be7.tar.bz2
ft_printf-e6d8f543af4c1a45f30495b90a3912b1c75f2be7.zip
Handled short convertions for unsigned int and hex
Diffstat (limited to 'convert_hex.c')
-rw-r--r--convert_hex.c8
1 files changed, 6 insertions, 2 deletions
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 <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);