aboutsummaryrefslogtreecommitdiffhomepage
path: root/gen/b2hex.cpp
blob: 150ade8b85146af94fd113644ffe5e4833e9393e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>

int main()
{
	puts("enum {");
	for (int i = 0; i < 256; i++) {
		printf("	B");
		for (int j = 0; j < 8; j++) {
			putchar(i & (1 << (7 - j)) ? '1' : '0');
		}
		printf("= %d", i);
		if (i < 255) putchar(',');
		putchar('\n');
	}
	puts("};");
	return 0;
}