summaryrefslogtreecommitdiffstats
path: root/src/corelib/arch/qatomic_armv6.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-08-06 18:15:49 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-18 18:35:50 +0200
commitc9bfd34fa00eb349f6fc37cbea58b71d96a05138 (patch)
tree6f6fab4d7a41ed04e48d98783d3bb0bb47e7bac7 /src/corelib/arch/qatomic_armv6.h
parent2b00f97ab05f144293b26d1e0d8cf4c54d222f92 (diff)
Enable QAtomicInteger for char16_t and char32_t
Those are regular, integer types, of 16- and 32-bit width, respectively. C++11's std::atomic supports them, so we should too. C++11 also supports wchar_t, but since that type's size can change, I don't feel like support for it in Qt is pressing. Change-Id: I945b641c91a8a98be82715f878c382dee58ac98b Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/arch/qatomic_armv6.h')
-rw-r--r--src/corelib/arch/qatomic_armv6.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/arch/qatomic_armv6.h b/src/corelib/arch/qatomic_armv6.h
index 1b13f84993..129c80eda8 100644
--- a/src/corelib/arch/qatomic_armv6.h
+++ b/src/corelib/arch/qatomic_armv6.h
@@ -74,6 +74,13 @@ QT_END_HEADER
template<> struct QAtomicIntegerTraits<int> { enum { IsInteger = 1 }; };
template<> struct QAtomicIntegerTraits<unsigned int> { enum { IsInteger = 1 }; };
+#if defined(Q_COMPILER_UNICODE_STRINGS) && !defined(Q_PROCESSOR_ARM_V6)
+// for ARMv5, ensure that char32_t (an uint_least32_t), is 32-bit
+// it's extremely unlikely it won't be on a 32-bit ARM, but just to be sure
+// For ARMv6 and up, we're sure it works, but the definition is below
+template<> struct QAtomicIntegerTraits<char32_t>
+{ enum { IsInteger = sizeof(char32_t) == sizeof(int) ? 1 : -1 }; };
+#endif
template <int size> struct QBasicAtomicOps: QGenericAtomicOps<QBasicAtomicOps<size> >
{
@@ -226,6 +233,11 @@ template<> struct QAtomicIntegerTraits<unsigned long> { enum { IsInteger = 1 };
template<> struct QAtomicIntegerTraits<long long> { enum { IsInteger = 1 }; };
template<> struct QAtomicIntegerTraits<unsigned long long> { enum { IsInteger = 1 }; };
+# ifdef Q_COMPILER_UNICODE_STRINGS
+template<> struct QAtomicIntegerTraits<char16_t> { enum { IsInteger = 1 }; };
+template<> struct QAtomicIntegerTraits<char32_t> { enum { IsInteger = 1 }; };
+# endif
+
#define Q_ATOMIC_INT8_IS_SUPPORTED
#define Q_ATOMIC_INT8_REFERENCE_COUNTING_IS_ALWAYS_NATIVE
#define Q_ATOMIC_INT8_TEST_AND_SET_IS_ALWAYS_NATIVE