<QtEndian> - Endian Conversion Functions

The <QtEndian> header provides functions to convert between little and big endian representations of numbers. More...

Functions

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

T qFromBigEndian(const uchar * 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.

Note: Template type T can either be a qint16, qint32 or qint64. Other types of integers, e.g., qlong, are not applicable.

There are no data alignment constraints for src.

This function was introduced in Qt 4.3.

See also qFromLittleEndian(), qToBigEndian(), and qToLittleEndian().

T qFromBigEndian(T src)
This is an overloaded function.

Converts 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 unmodified.

This function was introduced in Qt 4.3.

T qFromLittleEndian(const uchar * 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.

Note: Template type T can either be a qint16, qint32 or qint64. Other types of integers, e.g., qlong, are not applicable.

There are no data alignment constraints for src.

This function was introduced in Qt 4.3.

See also qFromBigEndian(), qToBigEndian(), and qToLittleEndian().

T qFromLittleEndian(T src)
This is an overloaded function.

Converts 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 unmodified.

This function was introduced in Qt 4.3.

void qToBigEndian(T src, uchar * 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).

There are no data alignment constraints for dest.

This function was introduced in Qt 4.3.

See also qFromBigEndian(), qFromLittleEndian(), and qToLittleEndian().

T qToBigEndian(T src)
This is an overloaded function.

Converts 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 unmodified.

This function was introduced in Qt 4.3.

void qToLittleEndian(T src, uchar * 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).

There are no data alignment constraints for dest.

This function was introduced in Qt 4.3.

See also qFromBigEndian(), qFromLittleEndian(), and qToBigEndian().

T qToLittleEndian(T src)
This is an overloaded function.

Converts 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 unmodified.

This function was introduced in Qt 4.3.

时间: 2024-09-30 18:40:51

<QtEndian> - Endian Conversion Functions的相关文章

理解字节序 [Understanding Big and Little Endian Byte Order]

原文地址 (本文对于字节序讲解的很清楚,容易理解.) Problems with byte order are frustrating, and I want to spare you the grief I experienced. Here's the key: Problem: Computers speak different languages, like people. Some write data "left-to-right" and others "rig

VHDL之conversion function

VHDL Type Cast and Conversion Functions The picture below illustrates how to convert between the most common VHDL types.

Using Single-Row Functions to Customize Output使用单行函数自定义输出

DUAL is a public table that you can use to view results from functions and calculations. SQL> select * from DUAL; D - X SQL> desc DUAL; Name                                      Null?    Type ----------------------------------------- -------- ------

Base Conversion In PHP and javascript

http://www.exploringbinary.com/base-conversion-in-php-using-built-in-functions/ http://www.binaryconvert.com/convert_float.html?decimal=054046056050049051 https://www.codeproject.com/Tips/387989/Convert-Binary-Single-Precision-Value-to-Float-in funct

OCP读书笔记(25) - 题库(ExamE)

401.Which of the following are correct about block media recovery? (Choose all that apply.)A. Physical and logical block corruption is recorded automatically in V$DATABASE_BLOCK_CORRUPTION.B. Logical corruptions are repairable by BMR.C. Physical corr

Boost 1.61.0 Library Documentation

http://www.boost.org/doc/libs/1_61_0/ Boost 1.61.0 Library Documentation Accumulators Framework for incremental calculation, and collection of statistical accumulators. Author(s): Eric Niebler First Release: 1.36.0 Standard: Categories: Math and nume

Video for Linux Two API Specification revision0.24【转】

转自:http://blog.csdn.net/jmq_0000/article/details/7536805#t136 Video for Linux Two API Specification Revision 0.24 Michael H Schimek <[email protected]> Bill Dirks Hans Verkuil Martin Rubli Copyright © 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,

整型变量(int)与字节数组(byte[])的相互转换

// int2byte.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <Windows.h> /* #define MAKEWORD(a, b) ((WORD)(((BYTE)(((DWORD_PTR)(a)) & 0xff)) | ((WORD)((BYTE)(((DWORD_PTR)(b)) & 0xff))) << 8)) #define MAKELONG(a, b) ((LONG

小布老师全部视频

http://www.boobooke.com/bbs/thread-7630-1-1.html 小布老师全部视频(更新时间:2011-08-10更新内容:Oracle 11g PL/SQL 23-27讲) 时间, 老师, Fundamentals, 视频 本帖最后由 river7000 于 2012-1-31 09:16 编辑 播布客Oracle交流群"197276682"群(上限500人)已满员,209931123群刚建立,须要增加的群友请加,我会缴请小布老师增加新建的群,欢迎小布