summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobal.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-10-19 17:00:39 -0400
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-30 18:05:16 +0100
commit07e831d7ff0662069491c22af953f4d6a9e2f3d9 (patch)
tree15ecbc5750bc2dc4c5a1962a499185910e8dfcc5 /src/corelib/global/qglobal.h
parent1cc0a18d794c6795a053f833fe8a633e2553a2a9 (diff)
Declare qregister[u]int, an integer the size of the machine's word
In almost all platforms, sizeof(qregisterint) == sizeof(void*) == sizeof(qptrdiff). It's different for architectures that have a pointer with a size different from the machine word. This allows us to declare variables of the most optimal size, even if the pointers are too wide or too narrow. The only currently-known architectures to match that case are the ILP32 builds on x86-64 (a.k.a "x32") and IA-64 (option -milp32, only available on HP-UXi), which have 64-bit registers but 32-bit pointers. Change-Id: I0f126b70ea9ea326bd3143797287e4b98210d36d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/corelib/global/qglobal.h')
-rw-r--r--src/corelib/global/qglobal.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index e68246e607..1e9b20757d 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -437,6 +437,8 @@ template <> struct QIntegerForSize<2> { typedef quint16 Unsigned; typedef qin
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 QIntegerForSize<Q_PROCESSOR_WORDSIZE>::Signed qregisterint;
+typedef QIntegerForSize<Q_PROCESSOR_WORDSIZE>::Unsigned qregisteruint;
typedef QIntegerForSizeof<void*>::Unsigned quintptr;
typedef QIntegerForSizeof<void*>::Signed qptrdiff;
typedef qptrdiff qintptr;