diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2008-02-22 08:01:00 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2008-02-22 08:01:00 -0800 |
commit | 7d23cc522e416ae1f3d2d53292ef438d1a08b0d7 (patch) | |
tree | 5f59908955de0cc52217c159db6c9c5688c959d8 /src/misc/util | |
parent | bd995ee2ca86bcb488d2e9592012b6077a6283f6 (diff) | |
download | abc-7d23cc522e416ae1f3d2d53292ef438d1a08b0d7.tar.gz abc-7d23cc522e416ae1f3d2d53292ef438d1a08b0d7.tar.bz2 abc-7d23cc522e416ae1f3d2d53292ef438d1a08b0d7.zip |
Version abc80222
Diffstat (limited to 'src/misc/util')
-rw-r--r-- | src/misc/util/port_type.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/misc/util/port_type.h b/src/misc/util/port_type.h new file mode 100644 index 00000000..316905f3 --- /dev/null +++ b/src/misc/util/port_type.h @@ -0,0 +1,60 @@ +// Portable Data Types + +#ifndef __PORT_TYPE__ +#define __PORT_TYPE__ + +/** + * Pointer difference type; replacement for ptrdiff_t. + * + * This is a signed integral type that is the same size as a pointer. + * + * NOTE: This type may be different sizes on different platforms. + */ +#if defined(__ccdoc__) +typedef platform_dependent_type PORT_PTRDIFF_T; +#elif defined(LIN64) +typedef long PORT_PTRDIFF_T; +#elif defined(NT64) +typedef long long PORT_PTRDIFF_T; +#elif defined(NT) || defined(LIN) || defined(WIN32) +typedef int PORT_PTRDIFF_T; +#else + #error unknown platform +#endif /* defined(PLATFORM) */ + +/** + * Unsigned integral type that can contain a pointer. + * + * This is an unsigned integral type that is the same size as a pointer. + * + * NOTE: This type may be different sizes on different platforms. + */ +#if defined(__ccdoc__) +typedef platform_dependent_type PORT_PTRUINT_T; +#elif defined(LIN64) +typedef unsigned long PORT_PTRUINT_T; +#elif defined(NT64) +typedef unsigned long long PORT_PTRUINT_T; +#elif defined(NT) || defined(LIN) || defined(WIN32) +typedef unsigned int PORT_PTRUINT_T; +#else + #error unknown platform +#endif /* defined(PLATFORM) */ + + +/** + * 64-bit signed integral type. + */ +#if defined(__ccdoc__) +typedef platform_dependent_type PORT_INT64_T; +#elif defined(LIN64) +typedef long PORT_INT64_T; +#elif defined(NT64) || defined(LIN) +typedef long long PORT_INT64_T; +#elif defined(WIN32) || defined(NT) +typedef signed __int64 PORT_INT64_T; +#else + #error unknown platform +#endif /* defined(PLATFORM) */ + +#endif |