Swap comparison order in case the value expensive to compare.

This commit is contained in:
Mat Sutcliffe
2019-03-29 22:50:33 +00:00
parent 6d9c1b4d5e
commit 5521a20883

View File

@@ -703,7 +703,7 @@ namespace BlackMisc
Q_ASSERT(QThread::currentThread() == thread()); Q_ASSERT(QThread::currentThread() == thread());
if (timestamp == 0) { timestamp = QDateTime::currentMSecsSinceEpoch(); } if (timestamp == 0) { timestamp = QDateTime::currentMSecsSinceEpoch(); }
bool changed = element.m_value.read() != value || element.m_timestamp != timestamp; bool changed = element.m_timestamp != timestamp || element.m_value.read() != value;
if (! changed && ! save && ! ignoreValue) { return {}; } if (! changed && ! save && ! ignoreValue) { return {}; }
if (ignoreValue) { value = element.m_value.read(); } if (ignoreValue) { value = element.m_value.read(); }