From 18ec250e0bdc5ca901744b926d9a062e6920ebbc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 16 Apr 2009 11:00:01 +0200 Subject: Condense this code into one single case. Avoid duplicating code. Just because I can. Reviewed-by: Bradley T. Hughes --- src/corelib/global/qglobal.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 5fd05c0..f058b36 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -821,17 +821,12 @@ typedef quint64 qulonglong; sizeof(void *) == sizeof(quintptr) && sizeof(void *) == sizeof(qptrdiff) */ -template class QUintForSize { private: typedef void Type; }; -template <> class QUintForSize<4> { public: typedef quint32 Type; }; -template <> class QUintForSize<8> { public: typedef quint64 Type; }; -template class QUintForType : public QUintForSize { }; -typedef QUintForType::Type quintptr; - -template class QIntForSize { private: typedef void Type; }; -template <> class QIntForSize<4> { public: typedef qint32 Type; }; -template <> class QIntForSize<8> { public: typedef qint64 Type; }; -template class QIntForType : public QIntForSize { }; -typedef QIntForType::Type qptrdiff; +template struct QIntegerForSize; +template <> struct QIntegerForSize<4> { typedef quint32 Unsigned; typedef qint32 Signed; }; +template <> struct QIntegerForSize<8> { typedef quint64 Unsigned; typedef qint64 Signed; }; +template struct QIntegerForSizeof: QIntegerForSize { }; +typedef QIntegerForSizeof::Unsigned quintptr; +typedef QIntegerForSizeof::Signed qptrdiff; /* Useful type definitions for Qt -- cgit v0.12