summaryrefslogtreecommitdiff
path: root/binary.c
blob: 9851f4480bc07dc90d8c9f4de50a2f147d41e9c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>

void binary32 (unsigned long value)
{
	int i;

	for(i=0;i<32;i++,value<<=1) {
		putchar( (1<<31 & value) ? '1' : '0' );

		if(i==23 || i==15 || i==7)
			putchar(' ');
	}
	putchar('\n');
}

void binary64(unsigned long long value)
{
	binary32 (value>>32);
	printf ("           ");
	binary32 (value);
}