diff options
Diffstat (limited to 'src/corelib/global/qendian.h')
-rw-r--r-- | src/corelib/global/qendian.h | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 98fab8f05b..8c3b5e4374 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -5,6 +5,10 @@ #ifndef QENDIAN_H #define QENDIAN_H +#if 0 +#pragma qt_class(QtEndian) +#endif + #include <QtCore/qfloat16.h> #include <QtCore/qglobal.h> @@ -101,6 +105,23 @@ inline constexpr T qbswap(T source) return T(qbswap_helper(typename QIntegerForSizeof<T>::Unsigned(source))); } +#ifdef QT_SUPPORTS_INT128 +// extra definitions for q(u)int128, in case std::is_integral_v<~~> == false +inline constexpr quint128 qbswap(quint128 source) +{ + quint128 result = {}; + result = qbswap_helper(quint64(source)); + result <<= 64; + result |= qbswap_helper(quint64(source >> 64)); + return result; +} + +inline constexpr qint128 qbswap(qint128 source) +{ + return qint128(qbswap(quint128(source))); +} +#endif + // floating specializations template<typename Float> Float qbswapFloatHelper(Float source) @@ -298,7 +319,7 @@ public: static constexpr T fromSpecial(T source) { return qFromBigEndian(source); } }; -#ifdef Q_CLANG_QDOC +#ifdef Q_QDOC template<typename T> class QLEInteger { public: @@ -319,8 +340,8 @@ public: QLEInteger &operator ^=(T i); QLEInteger &operator ++(); QLEInteger &operator --(); - QLEInteger &operator ++(int); - QLEInteger &operator --(int); + QLEInteger operator ++(int); + QLEInteger operator --(int); static constexpr QLEInteger max(); static constexpr QLEInteger min(); @@ -346,8 +367,8 @@ public: QBEInteger &operator ^=(T i); QBEInteger &operator ++(); QBEInteger &operator --(); - QBEInteger &operator ++(int); - QBEInteger &operator --(int); + QBEInteger operator ++(int); + QBEInteger operator --(int); static constexpr QBEInteger max(); static constexpr QBEInteger min(); |