diff options
Diffstat (limited to 'src/corelib/global/qendian.h')
-rw-r--r-- | src/corelib/global/qendian.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 8ecff5e165..e049fb6549 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -171,6 +171,11 @@ template <> inline qint16 qFromLittleEndian<qint16>(const uchar *src) { return static_cast<qint16>(qFromLittleEndian<quint16>(src)); } #endif +template <> inline quint8 qFromLittleEndian<quint8>(const uchar *src) +{ return static_cast<quint8>(src[0]); } +template <> inline qint8 qFromLittleEndian<qint8>(const uchar *src) +{ return static_cast<qint8>(src[0]); } + /* This function will read a big-endian (also known as network order) encoded value from \a src * and return the value in host-endian encoding. * There is no requirement that \a src must be aligned. @@ -263,6 +268,12 @@ template <> inline qint32 qFromBigEndian<qint32>(const uchar *src) template <> inline qint16 qFromBigEndian<qint16>(const uchar *src) { return static_cast<qint16>(qFromBigEndian<quint16>(src)); } #endif + +template <> inline quint8 qFromBigEndian<quint8>(const uchar *src) +{ return static_cast<quint8>(src[0]); } +template <> inline qint8 qFromBigEndian<qint8>(const uchar *src) +{ return static_cast<qint8>(src[0]); } + /* * T qbswap(T source). * Changes the byte order of a value from big endian to little endian or vice versa. @@ -367,6 +378,11 @@ template <> inline quint8 qbswap<quint8>(quint8 source) return source; } +template <> inline qint8 qbswap<qint8>(qint8 source) +{ + return source; +} + QT_END_NAMESPACE QT_END_HEADER |