#include 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; }