From 07e831d7ff0662069491c22af953f4d6a9e2f3d9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 19 Oct 2013 17:00:39 -0400 Subject: 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 --- src/corelib/global/qprocessordetection.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/corelib/global/qprocessordetection.h') diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index 623e30aa06..a5eff7c7ce 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -196,6 +196,7 @@ # define Q_PROCESSOR_X86 6 # define Q_PROCESSOR_X86_64 # define Q_BYTE_ORDER Q_LITTLE_ENDIAN +# define Q_PROCESSOR_WORDSIZE 8 /* Itanium (IA-64) family, no revisions or variants @@ -204,6 +205,7 @@ */ #elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) # define Q_PROCESSOR_IA64 +# define Q_PROCESSOR_WORDSIZE 8 // Q_BYTE_ORDER not defined, use endianness auto-detection /* @@ -324,4 +326,23 @@ # endif #endif +/* + Define Q_PROCESSOR_WORDSIZE to be the size of the machine's word (usually, + the size of the register). On some architectures where a pointer could be + smaller than the register, the macro is defined above. + + Try our best to define it to a literal, so it can be used in the preprocessor, + but fall back to sizeof(void*) on practically every 32-bit build. +*/ +#ifndef Q_PROCESSOR_WORDSIZE +# ifdef __SIZEOF_POINTER__ + /* GCC & friends define this */ +# define Q_PROCESSOR_WORDSIZE __SIZEOF_POINTER__ +# elif defined(_LP64) || defined(__LP64__) || defined(WIN64) || defined(_WIN64) +# define Q_PROCESSOR_WORDSIZE 8 +# else +# define Q_PROCESSOR_WORDSIZE sizeof(void*) +# endif +#endif + #endif // QPROCESSORDETECTION_H -- cgit v1.2.3 From a7b8ef08415b8056661c3db5950842ee546891b9 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 29 Jan 2014 11:41:31 +0100 Subject: Export optimized premultiply and unpremultiply methods This patch optimizes the unpremultiply method further by using a lookup table to avoid any divisions at all. The opportunity is taken to export both premultiply and unpremultiply since they are commonly used methods relevant to the exported QRgb type that can be both premultiplied and unpremultipled ARGB. [ChangeLog][QtGui][QColor] Exported highly optimized methods for premultiply and unpremultiply of QRgb values. Change-Id: I658bcf57b0bc73c34c1765b64617d43b63ae820b Reviewed-by: Thiago Macieira Reviewed-by: Gunnar Sletta --- src/corelib/global/qprocessordetection.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/corelib/global/qprocessordetection.h') diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h index a5eff7c7ce..cf7ee1b7aa 100644 --- a/src/corelib/global/qprocessordetection.h +++ b/src/corelib/global/qprocessordetection.h @@ -331,8 +331,7 @@ the size of the register). On some architectures where a pointer could be smaller than the register, the macro is defined above. - Try our best to define it to a literal, so it can be used in the preprocessor, - but fall back to sizeof(void*) on practically every 32-bit build. + Falls back to QT_POINTER_SIZE if not set explicitly for the platform. */ #ifndef Q_PROCESSOR_WORDSIZE # ifdef __SIZEOF_POINTER__ @@ -341,7 +340,7 @@ # elif defined(_LP64) || defined(__LP64__) || defined(WIN64) || defined(_WIN64) # define Q_PROCESSOR_WORDSIZE 8 # else -# define Q_PROCESSOR_WORDSIZE sizeof(void*) +# define Q_PROCESSOR_WORDSIZE QT_POINTER_SIZE # endif #endif -- cgit v1.2.3