<QtEndian> - Endian Conversion Functions

<QtEndian> 頭提供在數字的小端、大端錶示之間轉換的函數。 更多...

    函數

    T qFromBigEndian (T src )
    T qFromBigEndian (const void * src )
    T qFromLittleEndian (T src )
    T qFromLittleEndian (const void * src )
    T qToBigEndian (T src )
    void qToBigEndian (T src , void * dest )
    T qToLittleEndian (T src )
    void qToLittleEndian (T src , void * dest )

    函數文檔編製

    T qFromBigEndian ( T src )

    這是重載函數。

    轉換 src 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 src with the byte order swapped; otherwise it will return src 未經修改。

    該函數在 Qt 4.3 引入。

    T qFromBigEndian (const void * src )

    Reads a big-endian number from memory location src 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 src .

    注意: 模闆類型 T can either be a qint16, qint32 or qint64. Other types of integers, e.g., qlong, are not applicable.

    注意: 從 Qt 5.7 起,類型的 src 參數是 void 指針。

    沒有數據對齊約束對於 src .

    該函數在 Qt 4.3 引入。

    另請參閱 qFromLittleEndian (), qToBigEndian (),和 qToLittleEndian ().

    T qFromLittleEndian ( T src )

    這是重載函數。

    轉換 src 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 src with the byte order swapped; otherwise it will return src 未經修改。

    該函數在 Qt 4.3 引入。

    T qFromLittleEndian (const void * src )

    Reads a little-endian number from memory location src 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 src .

    注意: 模闆類型 T can either be a qint16, qint32 or qint64. Other types of integers, e.g., qlong, are not applicable.

    注意: 從 Qt 5.7 起,類型的 src 參數是 void 指針。

    沒有數據對齊約束對於 src .

    該函數在 Qt 4.3 引入。

    另請參閱 qFromBigEndian (), qToBigEndian (),和 qToLittleEndian ().

    T qToBigEndian ( T src )

    這是重載函數。

    轉換 src 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 src with the byte order swapped; otherwise it will return src 未經修改。

    該函數在 Qt 4.3 引入。

    void qToBigEndian ( T src , void * dest )

    Writes the number src with template type T to the memory location at dest in big-endian byte order.

    Note that template type T can only be an integer data type (signed or unsigned).

    沒有數據對齊約束對於 dest .

    注意: 從 Qt 5.7 起,類型的 dest 參數是 void 指針。

    該函數在 Qt 4.3 引入。

    另請參閱 qFromBigEndian (), qFromLittleEndian (),和 qToLittleEndian ().

    T qToLittleEndian ( T src )

    這是重載函數。

    轉換 src 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 src with the byte order swapped; otherwise it will return src 未經修改。

    該函數在 Qt 4.3 引入。

    void qToLittleEndian ( T src , void * dest )

    Writes the number src with template type T to the memory location at dest in little-endian byte order.

    Note that template type T can only be an integer data type (signed or unsigned).

    沒有數據對齊約束對於 dest .

    注意: 從 Qt 5.7 起,類型的 dest 參數是 void 指針。

    該函數在 Qt 4.3 引入。

    另請參閱 qFromBigEndian (), qFromLittleEndian (),和 qToBigEndian ().