From 41687ecb51bb85e3fc7fa19421f457a23e914318 Mon Sep 17 00:00:00 2001 From: Davis King Date: Sat, 29 Aug 2009 12:07:08 +0000 Subject: [PATCH] Added some typedefs for signed fixed width integers. --HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403164 --- dlib/uintn.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dlib/uintn.h b/dlib/uintn.h index ccdd21c0c..bc3efa48e 100644 --- a/dlib/uintn.h +++ b/dlib/uintn.h @@ -14,23 +14,35 @@ namespace dlib 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. 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__ typedef unsigned long long uint64; + typedef long long int64; #elif __BORLANDC__ typedef unsigned __int64 uint64; + typedef __int64 int64; #elif _MSC_VER typedef unsigned __int64 uint64; + typedef __int64 int64; #else typedef unsigned long long uint64; + typedef long long int64; #endif typedef unsigned short uint16; typedef unsigned int uint32; typedef unsigned char uint8; + typedef short int16; + typedef int int32; + typedef char int8; // 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(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