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 c4f7dba81e

Task-number: QTBUG-118221
Change-Id: I2cca75bfed7f0554f6cffd22cc06475ffc9c6e43
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
bb10
Ivan Solovev 2023-11-07 13:00:03 +01:00 committed by Marc Mutz
parent 2db7a5ebfb
commit aa8dfc5589
1 changed files with 1 additions and 1 deletions

View File

@ -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)