<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qendian.cpp --> <title><QtEndian> - Endian Conversion Functions | Qt Core 5.12.6</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.12</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><QtEndian> - Endian Conversion Functions</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtcore-index.html">Qt 5.12.6 Reference Documentation</a></td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"><div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title"><QtEndian> - Endian Conversion Functions</h1> <span class="subtitle"></span> <!-- $$$<QtEndian>-brief --> <p>The <QtEndian> header provides functions to convert between little and big endian representations of numbers. <a href="#details">More...</a></p> <!-- @@@<QtEndian> --> <ul> </ul> <a name="Types"></a> <h2 id="Types">Types</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qint16_be-typedef">qint16_be</a></b></td></tr> <tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qint16_le-typedef">qint16_le</a></b></td></tr> <tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qint32_be-typedef">qint32_be</a></b></td></tr> <tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qint32_le-typedef">qint32_le</a></b></td></tr> <tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qint64_be-typedef">qint64_be</a></b></td></tr> <tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qint64_le-typedef">qint64_le</a></b></td></tr> <tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#quint16_be-typedef">quint16_be</a></b></td></tr> <tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#quint16_le-typedef">quint16_le</a></b></td></tr> <tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#quint32_be-typedef">quint32_be</a></b></td></tr> <tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#quint32_le-typedef">quint32_le</a></b></td></tr> <tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#quint64_be-typedef">quint64_be</a></b></td></tr> <tr><td class="memItemLeft topAlign rightAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#quint64_le-typedef">quint64_le</a></b></td></tr> </table></div> <a name="Functions"></a> <h2 id="Functions">Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft topAlign rightAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qFromBigEndian">qFromBigEndian</a></b>(T <i>src</i>)</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qFromBigEndian">qFromBigEndian</a></b>(const void *<i>src</i>)</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qFromBigEndian-2">qFromBigEndian</a></b>(const void *<i>src</i>, qsizetype <i>count</i>, void *<i>dest</i>)</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a></b>(T <i>src</i>)</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a></b>(const void *<i>src</i>)</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qFromLittleEndian-2">qFromLittleEndian</a></b>(const void *<i>src</i>, qsizetype <i>count</i>, void *<i>dest</i>)</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qToBigEndian">qToBigEndian</a></b>(T <i>src</i>)</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qToBigEndian">qToBigEndian</a></b>(T <i>src</i>, void *<i>dest</i>)</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qToBigEndian-2">qToBigEndian</a></b>(const void *<i>src</i>, qsizetype <i>count</i>, void *<i>dest</i>)</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> T </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qToLittleEndian">qToLittleEndian</a></b>(T <i>src</i>)</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qToLittleEndian">qToLittleEndian</a></b>(T <i>src</i>, void *<i>dest</i>)</td></tr> <tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtendian.html#qToLittleEndian-2">qToLittleEndian</a></b>(const void *<i>src</i>, qsizetype <i>count</i>, void *<i>dest</i>)</td></tr> </table></div> <!-- $$$<QtEndian>-description --> <div class="descr"> <a name="details"></a> </div> <!-- @@@<QtEndian> --> <h2>Type Documentation</h2> <!-- $$$qint16_be --> <h3 class="fn" id="qint16_be-typedef"><a name="qint16_be-typedef"></a>typedef <span class="name">qint16_be</span></h3> <p>Typedef for <a href="qbeinteger.html">QBEInteger</a><qint16>. This type is guaranteed to be stored in memory as a 16-bit big-endian signed integer on all platforms supported by Qt.</p> <p>This typedef was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qtglobal.html#qint16-typedef">qint16</a>.</p> <!-- @@@qint16_be --> <!-- $$$qint16_le --> <h3 class="fn" id="qint16_le-typedef"><a name="qint16_le-typedef"></a>typedef <span class="name">qint16_le</span></h3> <p>Typedef for <a href="qleinteger.html">QLEInteger</a><qint16>. This type is guaranteed to be stored in memory as a 16-bit little-endian signed integer on all platforms supported by Qt.</p> <p>This typedef was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qtglobal.html#qint16-typedef">qint16</a>.</p> <!-- @@@qint16_le --> <!-- $$$qint32_be --> <h3 class="fn" id="qint32_be-typedef"><a name="qint32_be-typedef"></a>typedef <span class="name">qint32_be</span></h3> <p>Typedef for <a href="qbeinteger.html">QBEInteger</a><qint32>. This type is guaranteed to be stored in memory as a 32-bit big-endian signed integer on all platforms supported by Qt.</p> <p>This typedef was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qtglobal.html#qint32-typedef">qint32</a>.</p> <!-- @@@qint32_be --> <!-- $$$qint32_le --> <h3 class="fn" id="qint32_le-typedef"><a name="qint32_le-typedef"></a>typedef <span class="name">qint32_le</span></h3> <p>Typedef for <a href="qleinteger.html">QLEInteger</a><qint32>. This type is guaranteed to be stored in memory as a 32-bit little-endian signed integer on all platforms supported by Qt.</p> <p>This typedef was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qtglobal.html#qint32-typedef">qint32</a>.</p> <!-- @@@qint32_le --> <!-- $$$qint64_be --> <h3 class="fn" id="qint64_be-typedef"><a name="qint64_be-typedef"></a>typedef <span class="name">qint64_be</span></h3> <p>Typedef for <a href="qbeinteger.html">QBEInteger</a><qint64>. This type is guaranteed to be stored in memory as a 64-bit big-endian signed integer on all platforms supported by Qt.</p> <p>This typedef was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qtglobal.html#qint64-typedef">qint64</a>.</p> <!-- @@@qint64_be --> <!-- $$$qint64_le --> <h3 class="fn" id="qint64_le-typedef"><a name="qint64_le-typedef"></a>typedef <span class="name">qint64_le</span></h3> <p>Typedef for <a href="qleinteger.html">QLEInteger</a><qint64>. This type is guaranteed to be stored in memory as a 64-bit little-endian signed integer on all platforms supported by Qt.</p> <p>This typedef was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qtglobal.html#qint64-typedef">qint64</a>.</p> <!-- @@@qint64_le --> <!-- $$$quint16_be --> <h3 class="fn" id="quint16_be-typedef"><a name="quint16_be-typedef"></a>typedef <span class="name">quint16_be</span></h3> <p>Typedef for <a href="qbeinteger.html">QBEInteger</a><quint16>. This type is guaranteed to be stored in memory as a 16-bit big-endian unsigned integer on all platforms supported by Qt.</p> <p>This typedef was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qtglobal.html#quint16-typedef">quint16</a>.</p> <!-- @@@quint16_be --> <!-- $$$quint16_le --> <h3 class="fn" id="quint16_le-typedef"><a name="quint16_le-typedef"></a>typedef <span class="name">quint16_le</span></h3> <p>Typedef for <a href="qleinteger.html">QLEInteger</a><quint16>. This type is guaranteed to be stored in memory as a 16-bit little-endian unsigned integer on all platforms supported by Qt.</p> <p>This typedef was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qtglobal.html#quint16-typedef">quint16</a>.</p> <!-- @@@quint16_le --> <!-- $$$quint32_be --> <h3 class="fn" id="quint32_be-typedef"><a name="quint32_be-typedef"></a>typedef <span class="name">quint32_be</span></h3> <p>Typedef for <a href="qbeinteger.html">QBEInteger</a><quint32>. This type is guaranteed to be stored in memory as a 32-bit big-endian unsigned integer on all platforms supported by Qt.</p> <p>This typedef was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qtglobal.html#quint32-typedef">quint32</a>.</p> <!-- @@@quint32_be --> <!-- $$$quint32_le --> <h3 class="fn" id="quint32_le-typedef"><a name="quint32_le-typedef"></a>typedef <span class="name">quint32_le</span></h3> <p>Typedef for <a href="qleinteger.html">QLEInteger</a><quint32>. This type is guaranteed to be stored in memory as a 32-bit little-endian unsigned integer on all platforms supported by Qt.</p> <p>This typedef was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qtglobal.html#quint32-typedef">quint32</a>.</p> <!-- @@@quint32_le --> <!-- $$$quint64_be --> <h3 class="fn" id="quint64_be-typedef"><a name="quint64_be-typedef"></a>typedef <span class="name">quint64_be</span></h3> <p>Typedef for <a href="qbeinteger.html">QBEInteger</a><quint64>. This type is guaranteed to be stored in memory as a 64-bit big-endian unsigned integer on all platforms supported by Qt.</p> <p>This typedef was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qtglobal.html#quint64-typedef">quint64</a>.</p> <!-- @@@quint64_be --> <!-- $$$quint64_le --> <h3 class="fn" id="quint64_le-typedef"><a name="quint64_le-typedef"></a>typedef <span class="name">quint64_le</span></h3> <p>Typedef for <a href="qleinteger.html">QLEInteger</a><quint64>. This type is guaranteed to be stored in memory as a 64-bit little-endian unsigned integer on all platforms supported by Qt.</p> <p>This typedef was introduced in Qt 5.10.</p> <p><b>See also </b><a href="qtglobal.html#quint64-typedef">quint64</a>.</p> <!-- @@@quint64_le --> <h2>Function Documentation</h2> <!-- $$$qFromBigEndian[overload1]$$$qFromBigEndianT --> <h3 class="fn" id="qFromBigEndian"><a name="qFromBigEndian"></a><span class="type">T</span> <span class="name">qFromBigEndian</span>(<span class="type">T</span> <i>src</i>)</h3> <p>This is an overloaded function.</p> <p>Converts <i>src</i> from big-endian byte order and returns the number in host byte order representation of that number. On CPU architectures where the host byte order is little-endian (such as x86) this will return <i>src</i> with the byte order swapped; otherwise it will return <i>src</i> unmodified.</p> <p>This function was introduced in Qt 4.3.</p> <!-- @@@qFromBigEndian --> <!-- $$$qFromBigEndian[overload1]$$$qFromBigEndianconstvoid* --> <h3 class="fn" id="qFromBigEndian"><a name="qFromBigEndian"></a><span class="type">T</span> <span class="name">qFromBigEndian</span>(const <span class="type">void</span> *<i>src</i>)</h3> <p>Reads a big-endian number from memory location <i>src</i> and returns the number in the host byte order representation. On CPU architectures where the host byte order is little-endian (such as x86) this will swap the byte order; otherwise it will just read from <i>src</i>.</p> <p><b>Note: </b>Template type <code>T</code> can either be a quint16, qint16, quint32, qint32, quint64, or qint64. Other types of integers, e.g., qlong, are not applicable.</p><p><b>Note: </b>Since Qt 5.7, the type of the <i>src</i> parameter is a void pointer.</p><p>There are no data alignment constraints for <i>src</i>.</p> <p>This function was introduced in Qt 4.3.</p> <p><b>See also </b><a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a>(), <a href="qtendian.html#qToBigEndian">qToBigEndian</a>(), and <a href="qtendian.html#qToLittleEndian">qToLittleEndian</a>().</p> <!-- @@@qFromBigEndian --> <!-- $$$qFromBigEndian$$$qFromBigEndianconstvoid*qsizetypevoid* --> <h3 class="fn" id="qFromBigEndian-2"><a name="qFromBigEndian-2"></a><span class="type">void</span> <span class="name">qFromBigEndian</span>(const <span class="type">void</span> *<i>src</i>, <span class="type">qsizetype</span> <i>count</i>, <span class="type">void</span> *<i>dest</i>)</h3> <p>Reads <i>count</i> big-endian numbers from memory location <i>src</i> and stores them in the host byte order representation at <i>dest</i>. On CPU architectures where the host byte order is little-endian (such as x86) this will swap the byte order; otherwise it will just perform a <code>memcpy</code> from <i>src</i> to <i>dest</i>.</p> <p><b>Note: </b>Template type <code>T</code> can either be a quint16, qint16, quint32, qint32, quint64, or qint64. Other types of integers, e.g., qlong, are not applicable.</p><p>There are no data alignment constraints for <i>src</i>. However, <i>dest</i> is expected to be naturally aligned for type <code>T</code>.</p> <p>If <i>src</i> and <i>dest</i> can be the same pointer, this function will perform an in-place swap (if necessary). If they are not the same, the memory regions must not overlap.</p> <p>This function was introduced in Qt 5.12.</p> <p><b>See also </b><a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a>(), <a href="qtendian.html#qToBigEndian">qToBigEndian</a>(), and <a href="qtendian.html#qToLittleEndian">qToLittleEndian</a>().</p> <!-- @@@qFromBigEndian --> <!-- $$$qFromLittleEndian[overload1]$$$qFromLittleEndianT --> <h3 class="fn" id="qFromLittleEndian"><a name="qFromLittleEndian"></a><span class="type">T</span> <span class="name">qFromLittleEndian</span>(<span class="type">T</span> <i>src</i>)</h3> <p>This is an overloaded function.</p> <p>Converts <i>src</i> from little-endian byte order and returns the number in host byte order representation of that number. On CPU architectures where the host byte order is big-endian (such as PowerPC) this will return <i>src</i> with the byte order swapped; otherwise it will return <i>src</i> unmodified.</p> <p>This function was introduced in Qt 4.3.</p> <!-- @@@qFromLittleEndian --> <!-- $$$qFromLittleEndian[overload1]$$$qFromLittleEndianconstvoid* --> <h3 class="fn" id="qFromLittleEndian"><a name="qFromLittleEndian"></a><span class="type">T</span> <span class="name">qFromLittleEndian</span>(const <span class="type">void</span> *<i>src</i>)</h3> <p>Reads a little-endian number from memory location <i>src</i> and returns the number in the host byte order representation. On CPU architectures where the host byte order is big-endian (such as PowerPC) this will swap the byte order; otherwise it will just read from <i>src</i>.</p> <p><b>Note: </b>Template type <code>T</code> can either be a quint16, qint16, quint32, qint32, quint64, or qint64. Other types of integers, e.g., qlong, are not applicable.</p><p><b>Note: </b>Since Qt 5.7, the type of the <i>src</i> parameter is a void pointer.</p><p>There are no data alignment constraints for <i>src</i>.</p> <p>This function was introduced in Qt 4.3.</p> <p><b>See also </b><a href="qtendian.html#qFromBigEndian">qFromBigEndian</a>(), <a href="qtendian.html#qToBigEndian">qToBigEndian</a>(), and <a href="qtendian.html#qToLittleEndian">qToLittleEndian</a>().</p> <!-- @@@qFromLittleEndian --> <!-- $$$qFromLittleEndian$$$qFromLittleEndianconstvoid*qsizetypevoid* --> <h3 class="fn" id="qFromLittleEndian-2"><a name="qFromLittleEndian-2"></a><span class="type">void</span> <span class="name">qFromLittleEndian</span>(const <span class="type">void</span> *<i>src</i>, <span class="type">qsizetype</span> <i>count</i>, <span class="type">void</span> *<i>dest</i>)</h3> <p>Reads <i>count</i> little-endian numbers from memory location <i>src</i> and stores them in the host byte order representation at <i>dest</i>. On CPU architectures where the host byte order is big-endian (such as PowerPC) this will swap the byte order; otherwise it will just perform a <code>memcpy</code> from <i>src</i> to <i>dest</i>.</p> <p><b>Note: </b>Template type <code>T</code> can either be a quint16, qint16, quint32, qint32, quint64, or qint64. Other types of integers, e.g., qlong, are not applicable.</p><p>There are no data alignment constraints for <i>src</i>. However, <i>dest</i> is expected to be naturally aligned for type <code>T</code>.</p> <p>If <i>src</i> and <i>dest</i> can be the same pointer, this function will perform an in-place swap (if necessary). If they are not the same, the memory regions must not overlap.</p> <p>This function was introduced in Qt 5.12.</p> <p><b>See also </b><a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a>(), <a href="qtendian.html#qToBigEndian">qToBigEndian</a>(), and <a href="qtendian.html#qToLittleEndian">qToLittleEndian</a>().</p> <!-- @@@qFromLittleEndian --> <!-- $$$qToBigEndian[overload1]$$$qToBigEndianT --> <h3 class="fn" id="qToBigEndian"><a name="qToBigEndian"></a><span class="type">T</span> <span class="name">qToBigEndian</span>(<span class="type">T</span> <i>src</i>)</h3> <p>This is an overloaded function.</p> <p>Converts <i>src</i> from host byte order and returns the number in big-endian byte order representation of that number. On CPU architectures where the host byte order is little-endian (such as x86) this will return <i>src</i> with the byte order swapped; otherwise it will return <i>src</i> unmodified.</p> <p>This function was introduced in Qt 4.3.</p> <!-- @@@qToBigEndian --> <!-- $$$qToBigEndian[overload1]$$$qToBigEndianTvoid* --> <h3 class="fn" id="qToBigEndian"><a name="qToBigEndian"></a><span class="type">void</span> <span class="name">qToBigEndian</span>(<span class="type">T</span> <i>src</i>, <span class="type">void</span> *<i>dest</i>)</h3> <p>Writes the number <i>src</i> with template type <code>T</code> to the memory location at <i>dest</i> in big-endian byte order.</p> <p><b>Note: </b>Template type <code>T</code> can either be a quint16, qint16, quint32, qint32, quint64, or qint64. Other types of integers, e.g., qlong, are not applicable.</p><p>There are no data alignment constraints for <i>dest</i>.</p> <p><b>Note: </b>Since Qt 5.7, the type of the <i>dest</i> parameter is a void pointer.</p><p>This function was introduced in Qt 4.3.</p> <p><b>See also </b><a href="qtendian.html#qFromBigEndian">qFromBigEndian</a>(), <a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a>(), and <a href="qtendian.html#qToLittleEndian">qToLittleEndian</a>().</p> <!-- @@@qToBigEndian --> <!-- $$$qToBigEndian$$$qToBigEndianconstvoid*qsizetypevoid* --> <h3 class="fn" id="qToBigEndian-2"><a name="qToBigEndian-2"></a><span class="type">void</span> <span class="name">qToBigEndian</span>(const <span class="type">void</span> *<i>src</i>, <span class="type">qsizetype</span> <i>count</i>, <span class="type">void</span> *<i>dest</i>)</h3> <p>Reads <i>count</i> numbers from memory location <i>src</i> in the host byte order and stores them in big-endian representation at <i>dest</i>. On CPU architectures where the host byte order is little-endian (such as x86) this will swap the byte order; otherwise it will just perform a <code>memcpy</code> from <i>src</i> to <i>dest</i>.</p> <p><b>Note: </b>Template type <code>T</code> can either be a quint16, qint16, quint32, qint32, quint64, or qint64. Other types of integers, e.g., qlong, are not applicable.</p><p>There are no data alignment constraints for <i>dest</i>. However, <i>src</i> is expected to be naturally aligned for type <code>T</code>.</p> <p>If <i>src</i> and <i>dest</i> can be the same pointer, this function will perform an in-place swap (if necessary). If they are not the same, the memory regions must not overlap.</p> <p>This function was introduced in Qt 5.12.</p> <p><b>See also </b><a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a>(), <a href="qtendian.html#qToBigEndian">qToBigEndian</a>(), and <a href="qtendian.html#qToLittleEndian">qToLittleEndian</a>().</p> <!-- @@@qToBigEndian --> <!-- $$$qToLittleEndian[overload1]$$$qToLittleEndianT --> <h3 class="fn" id="qToLittleEndian"><a name="qToLittleEndian"></a><span class="type">T</span> <span class="name">qToLittleEndian</span>(<span class="type">T</span> <i>src</i>)</h3> <p>This is an overloaded function.</p> <p>Converts <i>src</i> from host byte order and returns the number in little-endian byte order representation of that number. On CPU architectures where the host byte order is big-endian (such as PowerPC) this will return <i>src</i> with the byte order swapped; otherwise it will return <i>src</i> unmodified.</p> <p>This function was introduced in Qt 4.3.</p> <!-- @@@qToLittleEndian --> <!-- $$$qToLittleEndian[overload1]$$$qToLittleEndianTvoid* --> <h3 class="fn" id="qToLittleEndian"><a name="qToLittleEndian"></a><span class="type">void</span> <span class="name">qToLittleEndian</span>(<span class="type">T</span> <i>src</i>, <span class="type">void</span> *<i>dest</i>)</h3> <p>Writes the number <i>src</i> with template type <code>T</code> to the memory location at <i>dest</i> in little-endian byte order.</p> <p><b>Note: </b>Template type <code>T</code> can either be a quint16, qint16, quint32, qint32, quint64, or qint64. Other types of integers, e.g., qlong, are not applicable.</p><p>There are no data alignment constraints for <i>dest</i>.</p> <p><b>Note: </b>Since Qt 5.7, the type of the <i>dest</i> parameter is a void pointer.</p><p>This function was introduced in Qt 4.3.</p> <p><b>See also </b><a href="qtendian.html#qFromBigEndian">qFromBigEndian</a>(), <a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a>(), and <a href="qtendian.html#qToBigEndian">qToBigEndian</a>().</p> <!-- @@@qToLittleEndian --> <!-- $$$qToLittleEndian$$$qToLittleEndianconstvoid*qsizetypevoid* --> <h3 class="fn" id="qToLittleEndian-2"><a name="qToLittleEndian-2"></a><span class="type">void</span> <span class="name">qToLittleEndian</span>(const <span class="type">void</span> *<i>src</i>, <span class="type">qsizetype</span> <i>count</i>, <span class="type">void</span> *<i>dest</i>)</h3> <p>Reads <i>count</i> numbers from memory location <i>src</i> in the host byte order and stores them in little-endian representation at <i>dest</i>. On CPU architectures where the host byte order is big-endian (such as PowerPC) this will swap the byte order; otherwise it will just perform a <code>memcpy</code> from <i>src</i> to <i>dest</i>.</p> <p><b>Note: </b>Template type <code>T</code> can either be a quint16, qint16, quint32, qint32, quint64, or qint64. Other types of integers, e.g., qlong, are not applicable.</p><p>There are no data alignment constraints for <i>dest</i>. However, <i>src</i> is expected to be naturally aligned for type <code>T</code>.</p> <p>If <i>src</i> and <i>dest</i> can be the same pointer, this function will perform an in-place swap (if necessary). If they are not the same, the memory regions must not overlap.</p> <p>This function was introduced in Qt 5.12.</p> <p><b>See also </b><a href="qtendian.html#qFromLittleEndian">qFromLittleEndian</a>(), <a href="qtendian.html#qToBigEndian">qToBigEndian</a>(), and <a href="qtendian.html#qToLittleEndian">qToLittleEndian</a>().</p> <!-- @@@qToLittleEndian --> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>