Hello,

I was recently working on some code where I wanted to use the QtEndian
stuff. I noticed that the functions that take const uchar* seem to do some
unnecessary operations.

For example this function is defined on a little endian target.

template <> inline quint32 qFromLittleEndian<quint32>(const uchar *src)
{
    return 0
        | src[0]
        | src[1] * quint32(0x00000100)
        | src[2] * quint32(0x00010000)
        | src[3] * quint32(0x01000000);
}

The memory being pointed at is already in little endian order. Why not just
reinterpret_cast instead of performing several operations? Wouldn't that be
faster? What am I missing?

Thanks
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qt-creator

Reply via email to