diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-04-16 09:00:01 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-04-16 10:50:44 (GMT) |
commit | 18ec250e0bdc5ca901744b926d9a062e6920ebbc (patch) | |
tree | 12d9aeb17af9b51408fb31034b52c578b031c313 /src/corelib/global/qglobal.h | |
parent | d43d33eb3121519d0025ad433d5c186365c47ef6 (diff) | |
download | Qt-18ec250e0bdc5ca901744b926d9a062e6920ebbc.zip Qt-18ec250e0bdc5ca901744b926d9a062e6920ebbc.tar.gz Qt-18ec250e0bdc5ca901744b926d9a062e6920ebbc.tar.bz2 |
Condense this code into one single case. Avoid duplicating code.
Just because I can.
Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src/corelib/global/qglobal.h')
-rw-r--r-- | src/corelib/global/qglobal.h | 17 |
1 files 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 <int> class QUintForSize { private: typedef void Type; }; -template <> class QUintForSize<4> { public: typedef quint32 Type; }; -template <> class QUintForSize<8> { public: typedef quint64 Type; }; -template <typename T> class QUintForType : public QUintForSize<sizeof(T)> { }; -typedef QUintForType<void *>::Type quintptr; - -template <int> class QIntForSize { private: typedef void Type; }; -template <> class QIntForSize<4> { public: typedef qint32 Type; }; -template <> class QIntForSize<8> { public: typedef qint64 Type; }; -template <typename T> class QIntForType : public QIntForSize<sizeof(T)> { }; -typedef QIntForType<void *>::Type qptrdiff; +template <int> struct QIntegerForSize; +template <> struct QIntegerForSize<4> { typedef quint32 Unsigned; typedef qint32 Signed; }; +template <> struct QIntegerForSize<8> { typedef quint64 Unsigned; typedef qint64 Signed; }; +template <class T> struct QIntegerForSizeof: QIntegerForSize<sizeof(T)> { }; +typedef QIntegerForSizeof<void*>::Unsigned quintptr; +typedef QIntegerForSizeof<void*>::Signed qptrdiff; /* Useful type definitions for Qt |