/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putnbrhex_upper.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: erey-bet +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/14 23:24:36 by erey-bet #+# #+# */ /* Updated: 2022/11/21 19:16:57 by erey-bet ### ########.fr */ /* */ /* ************************************************************************** */ #include "ft_printf.h" u32 ft_putnbrhex_upper_fd(u32 v, u32 fd) { u32 tmp = 0; u32 count = 0; char hex[100]; if (v == 0) return ft_putchar_fd('0', fd); while (v > 0) { tmp = v % 16; if (tmp < 10) hex[count++] = (tmp + 48); else hex[count++] = (tmp + 55); v = v / 16; } tmp = count; while (--tmp >= 0) ft_putchar_fd(hex[tmp], fd); return (count); }