-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_print_bits.c
30 lines (27 loc) · 1.08 KB
/
ft_print_bits.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_bits.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: igarbuz <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/10 18:31:39 by igarbuz #+# #+# */
/* Updated: 2018/11/16 16:51:18 by igarbuz ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_print_bits(unsigned char octet)
{
int i;
if (!octet)
return ;
i = 8;
while (--i >= 0)
{
if (octet & 1 << i)
ft_putchar('1');
else
ft_putchar('0');
}
ft_putchar('\n');
}