File: b2hex.cpp

package info (click to toggle)
xbyak 7.24.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,068 kB
  • sloc: cpp: 21,493; ansic: 2,981; python: 372; makefile: 306; sh: 204
file content (17 lines) | stat: -rw-r--r-- 274 bytes parent folder | download | duplicates (3)
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;
}