X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Finttypes.h;h=68b870cc97a3890ef23bb1948458c5df08351882;hp=c0af5ca9f2d2cf485b7a84d56285835087e3119c;hb=9f754b788b872f9768af8c3a4f9e001a588e011a;hpb=f7087c847a03a2bb4e9392e41eac4cb1ec37172c diff --git a/source/core/inttypes.h b/source/core/inttypes.h index c0af5ca..68b870c 100644 --- a/source/core/inttypes.h +++ b/source/core/inttypes.h @@ -1,70 +1,20 @@ #ifndef MSP_CORE_INTTYPES_H_ #define MSP_CORE_INTTYPES_H_ -#include -#include "typelist.h" +#include namespace Msp { -// Define lists of standard types, both signed and unsigned variants -typedef TypeList::Type StandardSignedTypes; -typedef TypeList::Type StandardUnsignedTypes; - -// Then add possible nonstandard types -#if defined(__GNUC__) -#if (__GNUC__>4 || (__GNUC__==4 && __GNUC_MINOR__>=6)) && defined(__LP64__) -#pragma GCC diagnostic push -#if __GNUC__>=5 -#pragma GCC diagnostic ignored "-Wpedantic" -#else -#pragma GCC diagnostic ignored "-pedantic" -#endif -typedef TypeList::Type PlatformSignedTypes; -typedef TypeList::Type PlatformUnsignedTypes; -#pragma GCC diagnostic pop -#else -typedef TypeList::Type PlatformSignedTypes; -typedef TypeList::Type PlatformUnsignedTypes; -#endif -#elif defined(_MSC_VER) -typedef TypeList::Type PlatformSignedTypes; -typedef TypeList::Type PlatformUnsignedTypes; -#else -typedef StandardSignedTypes PlatformSignedTypes; -typedef StandardUnsignedTypes PlatformUnsignedTypes; -#endif - -/** A helper for choosing an integer type of a specific size. The size -parameter is in bits. The resulting types can be obtained from the SignedType -and UnsignedType typedefs. */ -template -struct Int -{ - template - struct Predicate - { - enum { value = (sizeof(T)*CHAR_BIT==size) }; - }; - - typedef typename TypeChooser::Type SignedType; - typedef typename TypeChooser::Type UnsignedType; -}; - -/** A helper for choosing an integer that's the same size as another type. */ -template -struct MatchingInt: Int -{ }; - -// Finally define convenient shorthands for the actual integer types -typedef Int<8>::SignedType Int8; -typedef Int<8>::UnsignedType UInt8; -typedef Int<16>::SignedType Int16; -typedef Int<16>::UnsignedType UInt16; -typedef Int<32>::SignedType Int32; -typedef Int<32>::UnsignedType UInt32; -typedef Int<64>::SignedType Int64; -typedef Int<64>::UnsignedType UInt64; -typedef MatchingInt::UnsignedType IntPtr; +// These typedefs will be deprecated at some point +typedef std::int8_t Int8; +typedef std::uint8_t UInt8; +typedef std::int16_t Int16; +typedef std::uint16_t UInt16; +typedef std::int32_t Int32; +typedef std::uint32_t UInt32; +typedef std::int64_t Int64; +typedef std::uint64_t UInt64; +typedef std::intptr_t IntPtr; } // namespace Msp