Enable endianness conversions on q(u)int8
authorJoão Abecasis <joao.abecasis@nokia.com>
Wed, 21 Mar 2012 17:09:09 +0000 (18:09 +0100)
committerQt by Nokia <qt-info@nokia.com>
Sun, 25 Mar 2012 11:12:24 +0000 (13:12 +0200)
commitfe778b94bd58c12949d763f428d214e8c16d144e
tree878c41fcc5f18a33d57c34a27cc69f0eb940bb7e
parent552e162a67a1afcdc4e3e344100abaa6a69ab918
Enable endianness conversions on q(u)int8

Lack of support for these types is not a real issue as endian
conversions on byte-sized types are no-ops. Still, the conversions are
useful as they facilitate writing of generic code. They can also be used
explicitly as a way to document in code an endian-specific binary
format:

     uchar *data;
     quint8 tag = qFromLittleEndian<quint8>(data++);
     quint32 size = qFromLittleEndian<quint32>(data);

This commit also adds a test for functions documented in the QtEndian
header.

Change-Id: I2f6c876ce89d2adb8c03a1c8a25921d225bf6f92
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
src/corelib/global/qendian.h
tests/auto/corelib/global/global.pro
tests/auto/corelib/global/qtendian/qtendian.pro [new file with mode: 0644]
tests/auto/corelib/global/qtendian/tst_qtendian.cpp [new file with mode: 0644]