| 1 | // Copyright (C) 2011 Thiago Macieira <thiago@kde.org> |
| 2 | // Copyright (C) 2016 Intel Corporation. |
| 3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 4 | // Qt-Security score:significant reason:default |
| 5 | |
| 6 | #ifndef QGENERICATOMIC_H |
| 7 | #define QGENERICATOMIC_H |
| 8 | |
| 9 | #include <QtCore/qcompilerdetection.h> |
| 10 | #include <QtCore/qtconfigmacros.h> |
| 11 | #include <QtCore/qtypes.h> |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | #if 0 |
| 16 | // silence syncqt warnings |
| 17 | QT_END_NAMESPACE |
| 18 | #pragma qt_sync_skip_header_check |
| 19 | #pragma qt_sync_stop_processing |
| 20 | #endif |
| 21 | |
| 22 | template<int Size> struct QAtomicOpsSupport |
| 23 | { |
| 24 | enum { IsSupported = (Size == sizeof(int) || Size == sizeof(qptrdiff)) }; |
| 25 | }; |
| 26 | |
| 27 | template <typename T> struct QAtomicAdditiveType |
| 28 | { |
| 29 | typedef T AdditiveT; |
| 30 | static const int AddScale = 1; |
| 31 | }; |
| 32 | template <typename T> struct QAtomicAdditiveType<T *> |
| 33 | { |
| 34 | typedef qptrdiff AdditiveT; |
| 35 | static const int AddScale = sizeof(T); |
| 36 | }; |
| 37 | |
| 38 | QT_END_NAMESPACE |
| 39 | #endif // QGENERICATOMIC_H |
| 40 | |