From 5d1e4567f975cd5720d22adb65c6fb55bfb21464 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Fri, 18 Aug 2023 21:31:58 +0300 Subject: [PATCH] QDateTime: refactor an if-else Change-Id: I1d1bd6d0e819e525b03898d43a2a683ee617a3ed Reviewed-by: Edward Welbourne --- src/corelib/time/qdatetime.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 20a3439f09..4afd08b65b 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -4387,14 +4387,8 @@ QDateTime QDateTime::addMSecs(qint64 msecs) const dt.d.detach(); dt.d->m_status &= ~QDateTimePrivate::ValidityMask; } - } else if (d.isShort()) { - // need to check if we need to enlarge first - if (msecsCanBeSmall(msecs)) { - dt.d.data.msecs = qintptr(msecs); - } else { - dt.d.detach(); - dt.d->m_msecs = msecs; - } + } else if (d.isShort() && msecsCanBeSmall(msecs)) { + dt.d.data.msecs = qintptr(msecs); } else { dt.d.detach(); dt.d->m_msecs = msecs;