From aa8dfc5589e26fe10c5e5ca439b0a4a4212d0b1f Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Tue, 7 Nov 2023 13:00:03 +0100 Subject: [PATCH] QDate: fix condition in conversion between chrono types and Julian Day Surely, sizeof() returns the number of bytes, so we need to multiply by CHAR_BIT if we want to compare with the number of bits. This commit amends c4f7dba81e43c11c1e71c19ef7f0b5acad119e60 Task-number: QTBUG-118221 Change-Id: I2cca75bfed7f0554f6cffd22cc06475ffc9c6e43 Reviewed-by: Marc Mutz --- src/corelib/time/qdatetime.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h index c3b025c6b9..bbfc0ec9fc 100644 --- a/src/corelib/time/qdatetime.h +++ b/src/corelib/time/qdatetime.h @@ -155,7 +155,7 @@ private: { const auto epochDays = days.time_since_epoch().count(); // minJd() and maxJd() fit into 40 bits. - if constexpr (sizeof(epochDays) >= 41) { + if constexpr (sizeof(epochDays) * CHAR_BIT >= 41) { constexpr auto top = maxJd() - unixEpochJd(); constexpr auto bottom = minJd() - unixEpochJd(); if (epochDays > top || epochDays < bottom)