Added some typedefs for signed fixed width integers.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403164
This commit is contained in:
Davis King 2009-08-29 12:07:08 +00:00
parent bb75e2daed
commit 41687ecb51
1 changed files with 17 additions and 0 deletions

View File

@ -14,23 +14,35 @@ namespace dlib
uint32 is a typedef for an unsigned integer that is exactly 32 bits wide. uint32 is a typedef for an unsigned integer that is exactly 32 bits wide.
uint16 is a typedef for an unsigned integer that is exactly 16 bits wide. uint16 is a typedef for an unsigned integer that is exactly 16 bits wide.
uint8 is a typedef for an unsigned integer that is exactly 8 bits wide. uint8 is a typedef for an unsigned integer that is exactly 8 bits wide.
int64 is a typedef for an integer that is exactly 64 bits wide.
int32 is a typedef for an integer that is exactly 32 bits wide.
int16 is a typedef for an integer that is exactly 16 bits wide.
int8 is a typedef for an integer that is exactly 8 bits wide.
!*/ !*/
#ifdef __GNUC__ #ifdef __GNUC__
typedef unsigned long long uint64; typedef unsigned long long uint64;
typedef long long int64;
#elif __BORLANDC__ #elif __BORLANDC__
typedef unsigned __int64 uint64; typedef unsigned __int64 uint64;
typedef __int64 int64;
#elif _MSC_VER #elif _MSC_VER
typedef unsigned __int64 uint64; typedef unsigned __int64 uint64;
typedef __int64 int64;
#else #else
typedef unsigned long long uint64; typedef unsigned long long uint64;
typedef long long int64;
#endif #endif
typedef unsigned short uint16; typedef unsigned short uint16;
typedef unsigned int uint32; typedef unsigned int uint32;
typedef unsigned char uint8; typedef unsigned char uint8;
typedef short int16;
typedef int int32;
typedef char int8;
// make sure these types have the right sizes on this platform // make sure these types have the right sizes on this platform
@ -39,6 +51,11 @@ namespace dlib
COMPILE_TIME_ASSERT(sizeof(uint32) == 4); COMPILE_TIME_ASSERT(sizeof(uint32) == 4);
COMPILE_TIME_ASSERT(sizeof(uint64) == 8); COMPILE_TIME_ASSERT(sizeof(uint64) == 8);
COMPILE_TIME_ASSERT(sizeof(int8) == 1);
COMPILE_TIME_ASSERT(sizeof(int16) == 2);
COMPILE_TIME_ASSERT(sizeof(int32) == 4);
COMPILE_TIME_ASSERT(sizeof(int64) == 8);
template <typename T, size_t s = sizeof(T)> template <typename T, size_t s = sizeof(T)>