diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2023-02-06 13:39:03 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2023-02-22 14:27:35 +0000 |
commit | 85c69f023fe281b7f16e1a93e61be4432f7fef9b (patch) | |
tree | cbab2d16e4220467da07f321d966bc8b4bff5c36 /src/corelib/kernel/qmath.h | |
parent | f7fd5eaf95c964956b2b353784105c89950ffff2 (diff) |
qmath: add qNextPowerOfTwo(unsigned long) - for size_t
This completes the triad uint/ulong/qulonglong, ensuring that one of
them will be size_t and one of them will be uintptr_t (size_t and
uintptr_t don't have to be the same type). The signeds ensure one of
them will be ptrdiff_t too.
Pick-to: 6.5
Change-Id: I9671dee8ceb64aa9b9cafffd17415a0bfcbd68b7
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Diffstat (limited to 'src/corelib/kernel/qmath.h')
-rw-r--r-- | src/corelib/kernel/qmath.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h index b1e5b4f17e..72057ee16d 100644 --- a/src/corelib/kernel/qmath.h +++ b/src/corelib/kernel/qmath.h @@ -370,6 +370,16 @@ constexpr inline quint64 qNextPowerOfTwo(qint64 v) return qNextPowerOfTwo(quint64(v)); } +constexpr inline unsigned long qNextPowerOfTwo(unsigned long v) +{ + return qNextPowerOfTwo(QIntegerForSizeof<long>::Unsigned(v)); +} + +constexpr inline unsigned long qNextPowerOfTwo(long v) +{ + return qNextPowerOfTwo(QIntegerForSizeof<long>::Unsigned(v)); +} + QT_END_NAMESPACE #endif // QMATH_H |