From f94eea0176e7ecd2c9c6a748259e08a4361d9478 Mon Sep 17 00:00:00 2001 From: Rolland Dudemaine Date: Tue, 15 Nov 2011 17:28:11 +0100 Subject: Resolve atomic operations issues on INTEGRITY. Now passes atomicpointer autotest successfully. Merge-request: 1438 Reviewed-by: Harald Fernengel --- src/corelib/arch/qatomic_integrity.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/corelib/arch/qatomic_integrity.h b/src/corelib/arch/qatomic_integrity.h index f957297..c72a48d 100644 --- a/src/corelib/arch/qatomic_integrity.h +++ b/src/corelib/arch/qatomic_integrity.h @@ -203,7 +203,7 @@ inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) template Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetOrdered(T *expectedValue, T *newValue) { - return TestAndSet((Address*)&_q_value, qt_addr(expectedValue), qt_addr(newValue)) == Success; + return TestAndSet(reinterpret_cast
(const_cast(&_q_value)), qt_addr(expectedValue), qt_addr(newValue)) == Success; } template @@ -231,7 +231,7 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreOrdered(T *newValue) { Address old_val; do { - old_val = *reinterpret_cast
(const_cast(newValue)); + old_val = *reinterpret_cast
(const_cast(_q_value)); } while (TestAndSet(reinterpret_cast
(const_cast(&_q_value)), old_val, qt_addr(newValue)) != Success); return reinterpret_cast(old_val); } @@ -259,7 +259,8 @@ Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreRelease(T *newValue) template Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddOrdered(qptrdiff valueToAdd) { - AtomicModify(qt_p2addr(&_q_value), qt_addr(_q_value), qt_addr(_q_value) + valueToAdd * sizeof(T)); + Address old_value; + AtomicModify(reinterpret_cast(&_q_value), &old_value, 0, valueToAdd * sizeof(T)); return _q_value; } -- cgit v0.12