* @brief Hot-path write by handle; non-computed (guard matches set()), stale, or invalid handles * are ignored silently, with no warning so a misused handle cannot spam the log per frame. * An identical value is a successful no-op that leaves the slot version untouched. */
| 405 | * An identical value is a successful no-op that leaves the slot version untouched. |
| 406 | */ |
| 407 | bool DataModel::DataTableStore::setByHandle(qint64 handle, const RegisterValue& val) |
| 408 | { |
| 409 | Q_ASSERT(m_initialized); |
| 410 | Q_ASSERT(m_isComputed.size() == m_storage.size()); |
| 411 | |
| 412 | if (handle < 0) [[unlikely]] |
| 413 | return false; |
| 414 | |
| 415 | const int gen = static_cast<int>(handle >> kHandleIndexBits); |
| 416 | const int index = static_cast<int>(handle & kHandleIndexMask); |
| 417 | if (gen != m_generation || index >= static_cast<int>(m_storage.size())) [[unlikely]] |
| 418 | return false; |
| 419 | |
| 420 | if (!m_isComputed[static_cast<size_t>(index)]) [[unlikely]] |
| 421 | return false; |
| 422 | |
| 423 | if (sameRegisterValue(m_storage[static_cast<size_t>(index)], val)) |
| 424 | return true; |
| 425 | |
| 426 | m_storage[static_cast<size_t>(index)] = val; |
| 427 | m_version[static_cast<size_t>(index)] = ++m_writeClock; |
| 428 | return true; |
| 429 | } |
| 430 | |
| 431 | //-------------------------------------------------------------------------------------------------- |
| 432 | // System dataset table |
no test coverage detected