inlib  1.2.0
/Users/barrand/private/dev/softinex/old/inexlib-1.2/inlib/inlib/typedefs
Go to the documentation of this file.
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
00002 // See the file inlib.license for terms.
00003 
00004 #ifndef inlib_typedefs
00005 #define inlib_typedefs
00006 
00007 // Similar to AIDA/v3r3p0/Types.h
00008 
00009 //NOTE : we avoid to have std includes here to be sure
00010 //       that in the below ifdef things come only from the compiler.
00011 
00012 //NOTE : if adding new platform here, look at ./s2int64 too.
00013 
00014 namespace inlib {
00015 
00016 #if defined(WIN32) && !defined(GNU_GCC)
00017 
00018 // WIN32 and NOT GNU_GCC
00019 typedef int int32;
00020 typedef __int64 int64;
00021 inline const char* int32_format() {static const char s[] = "%d";return s;}
00022 inline const char* int64_format() {static const char s[] = "%ld";return s;}
00023 
00024 typedef unsigned int uint32;
00025 typedef unsigned __int64 uint64;
00026 inline const char* uint32_format() {static const char s[] = "%u";return s;}
00027 inline const char* uint64_format() {static const char s[] = "%lu";return s;}
00028 
00029 #elif defined(_LP64) 
00030 
00031 // 64 Bit Platforms
00032 typedef int int32;
00033 typedef long int64;
00034 inline const char* int32_format() {static const char s[] = "%d";return s;}
00035 inline const char* int64_format() {static const char s[] = "%ld";return s;}
00036 
00037 typedef unsigned int uint32;
00038 typedef unsigned long uint64;
00039 inline const char* uint32_format() {static const char s[] = "%u";return s;}
00040 inline const char* uint64_format() {static const char s[] = "%lu";return s;}
00041 
00042 #else 
00043 
00044 // 32-Bit Platforms
00045 typedef int int32;
00046 typedef long long int64;
00047 inline const char* int32_format() {static const char s[] = "%d";return s;}
00048 inline const char* int64_format() {static const char s[] = "%lld";return s;}
00049 
00050 typedef unsigned int uint32;
00051 typedef unsigned long long uint64;
00052 inline const char* uint32_format() {static const char s[] = "%u";return s;}
00053 inline const char* uint64_format() {static const char s[] = "%llu";return s;}
00054 
00055 #endif
00056 
00057 inline uint32 uint32_mx() { //4 294 967 295
00058   uint32 n = 0;
00059   for(unsigned int i=0;i<32;i++)  n += 1<<i;  
00060   return n;
00061 }
00062 inline uint64 uint64_mx() { //18 446 744 073 709 551 614
00063   uint64 n = 0;
00064   for(unsigned int i=0;i<64;i++)  n += 1<<i;  
00065   return n;
00066 }
00067 
00068 typedef unsigned char byte;
00069 
00070 //for ./io :
00071 typedef unsigned char uchar;
00072 typedef short int16;
00073 typedef unsigned short uint16;
00074 typedef uint32 ref;
00075 // sizeof(long)==sizeof(void*) on all platforms.
00076 typedef unsigned long diff_pointer_t;
00077 typedef char* cstr_t;
00078 typedef const char* const_cstr_t;
00079 
00080 }
00081 
00082 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines