diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/resources/qresourcemanager_p.h | 39 | ||||
-rw-r--r-- | src/core/transforms/matrix4x4_avx2_p.h | 1 | ||||
-rw-r--r-- | src/core/transforms/matrix4x4_sse_p.h | 1 |
3 files changed, 11 insertions, 30 deletions
diff --git a/src/core/resources/qresourcemanager_p.h b/src/core/resources/qresourcemanager_p.h index ba39695a4..6e479d5ef 100644 --- a/src/core/resources/qresourcemanager_p.h +++ b/src/core/resources/qresourcemanager_p.h @@ -179,19 +179,7 @@ private: template <typename T> struct QResourceInfo { - enum - { - needsCleanup = false - }; -}; - -template <> -struct QResourceInfo<void> -{ - enum - { - needsCleanup = false - }; + static const bool needsCleanup = false; }; enum @@ -204,22 +192,10 @@ enum template<> \ struct QResourceInfo<TYPE > \ { \ - enum \ -{ \ - needsCleanup = ((FLAGS & Q_REQUIRES_CLEANUP) == 0) \ -}; \ + static const bool needsCleanup = (FLAGS & Q_REQUIRES_CLEANUP) == 0;\ }; \ } // namespace Qt3DCore -template <int v> -struct Int2Type -{ - enum - { - value = v - }; -}; - template<typename T> class QHandleData : public QHandle<T>::Data { @@ -275,7 +251,7 @@ public: typename Handle::Data *d = handle.data_ptr(); d->nextFree = freeList; freeList = d; - performCleanup(&static_cast<QHandleData<T> *>(d)->data, Int2Type<QResourceInfo<T>::needsCleanup>()); + performCleanup(&static_cast<QHandleData<T> *>(d)->data, std::integral_constant<bool, QResourceInfo<T>::needsCleanup>{}); } T *data(Handle h) @@ -349,13 +325,16 @@ private: } } - void performCleanup(T *r, Int2Type<true>) + template<typename Q = T> + void performCleanup(Q *r, std::integral_constant<bool, true>) { r->cleanup(); } - void performCleanup(T *, Int2Type<false>) - {} + template<typename Q = T> + void performCleanup(Q *, std::integral_constant<bool, false>) + { + } }; diff --git a/src/core/transforms/matrix4x4_avx2_p.h b/src/core/transforms/matrix4x4_avx2_p.h index 63858b35c..0b35f0016 100644 --- a/src/core/transforms/matrix4x4_avx2_p.h +++ b/src/core/transforms/matrix4x4_avx2_p.h @@ -489,6 +489,7 @@ public: friend Q_3DCORE_PRIVATE_EXPORT Vector3D operator*(const Matrix4x4_AVX2 &matrix, const Vector3D &vector); friend Q_3DCORE_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Matrix4x4_AVX2 &m); + private: // column major order // aligned on 32 bytes boundaries for AVX, compatible with 16 bytes boundary for SSE diff --git a/src/core/transforms/matrix4x4_sse_p.h b/src/core/transforms/matrix4x4_sse_p.h index 0ea2e37ad..adef74daf 100644 --- a/src/core/transforms/matrix4x4_sse_p.h +++ b/src/core/transforms/matrix4x4_sse_p.h @@ -372,6 +372,7 @@ public: friend Q_ALWAYS_INLINE Vector3D operator*(const Matrix4x4_SSE &matrix, const Vector3D &vector); friend Q_3DCORE_PRIVATE_EXPORT QDebug operator<<(QDebug dbg, const Matrix4x4_SSE &m); + private: // Internally we will store the matrix as indicated below // Q_DECL_ALIGN(16) // aligned on 16 bytes boundary for SSE (column major) |