blob: 92c55bc190b3c9d295b1b7e95f6b1dda554027cf (
plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#include <stdio.h>
int main(void)
{
unsigned char us; /* using short makes twofish colapse */
unsigned int ui;
unsigned long ul;
unsigned long long ull;
printf("#ifndef _UINT_H\n#define _UINT_H\n\n");
printf(" /* This file was auto-generated. Do not edit! */\n\n");
/* u8 */
us = 1<<6;
us += us;
if(us)printf("typedef unsigned char u8;\n\n");
else{
ui = 1<<6;
ui += ui;
if(ui) printf("typedef unsigned int u8;\n\n");
}
printf("#define U8_MAX 0xFF\n\n");
/* u16 */
ui = 1<<14;
ui += ui;
if(ui)printf("typedef unsigned int u16;\n\n");
else{
ul = 1<<14;
ul += ul;
if(ul) printf("typedef unsigned long u16;\n\n");
}
printf("#define U16_MAX 0xFFFF\n\n");
/* u32 */
ui = 1<<30;
ui += ui;
if(ui)printf("typedef unsigned int u32;\n\n");
else{
ul = 1<<30;
ul += ul;
if(ul) printf("typedef unsigned long u32;\n\n");
else{
ull = 1<<30;
ull += ull;
if(ull) printf("typedef unsigned long long u32;\n\n");
}
}
printf("#define U32_MAX 0xFFFFFFFF\n\n");
/* u64 */
ui = 1<<31;
ui += ui; ui += ui; ui += ui; ui += ui; ui += ui; ui += ui; ui += ui; ui += ui;
ui += ui; ui += ui; ui += ui; ui += ui; ui += ui; ui += ui; ui += ui; ui += ui;
ui += ui; ui += ui; ui += ui; ui += ui; ui += ui; ui += ui; ui += ui; ui += ui;
ui += ui; ui += ui; ui += ui; ui += ui; ui += ui; ui += ui; ui += ui; ui += ui;
if(ui)printf("typedef unsigned int u64;\n\n");
else{
ul = 1<<31;
ul += ul; ul += ul; ul += ul; ul += ul; ul += ul; ul += ul; ul += ul; ul += ul;
ul += ul; ul += ul; ul += ul; ul += ul; ul += ul; ul += ul; ul += ul; ul += ul;
ul += ul; ul += ul; ul += ul; ul += ul; ul += ul; ul += ul; ul += ul; ul += ul;
ul += ul; ul += ul; ul += ul; ul += ul; ul += ul; ul += ul; ul += ul; ul += ul;
if(ul) printf("typedef unsigned long u64;\n\n");
else{
ull = 1<<31;
ull += ull; ull += ull; ull += ull; ull += ull; ull += ull; ull += ull; ull += ull; ull += ull;
ull += ull; ull += ull; ull += ull; ull += ull; ull += ull; ull += ull; ull += ull; ull += ull;
ull += ull; ull += ull; ull += ull; ull += ull; ull += ull; ull += ull; ull += ull; ull += ull;
ull += ull; ull += ull; ull += ull; ull += ull; ull += ull; ull += ull; ull += ull; ull += ull;
if(ull) printf("typedef unsigned long long u64;\n\n");
else printf(" * no u64 available !! *\n\n");
}
}
printf("#define U64_MAX 0xFFFFFFFFFFFFFFFF\n\n");
printf("#endif\n");
return 0;
}
|