Defold Learn logo


Endian

Endian conversion functions.

Include: #include <dmsdk/dlib/endian.h>
FUNCTIONS
uint16_t EndianSwap16 (uint16_t x) swap bytes in a 16-bit value
uint32_t EndianSwap32 (uint32_t x) swap bytes in a 32-bit value
uint64_t EndianSwap64 (uint64_t x) swap bytes in a 64-bit value
uint16_t EndianToHost16 (uint16_t x) convert a 16-bit network value to host byte order
uint32_t EndianToHost32 (uint32_t x) convert a 32-bit network value to host byte order
uint64_t EndianToHost64 (uint64_t x) convert a 64-bit network value to host byte order
uint16_t EndianToNetwork16 (uint16_t x) convert a 16-bit host value to network byte order
uint32_t EndianToNetwork32 (uint32_t x) convert a 32-bit host value to network byte order
uint64_t EndianToNetwork64 (uint64_t x) convert a 64-bit host value to network byte order

Functions

EndianSwap16

uint16_t EndianSwap16(uint16_t x)

swap bytes in a 16-bit value

PARAMETERS

uint16_t x Value to byte swap

RETURNS

uint16_t Byte-swapped value

EndianSwap32

uint32_t EndianSwap32(uint32_t x)

swap bytes in a 32-bit value

PARAMETERS

uint32_t x Value to byte swap

RETURNS

uint32_t Byte-swapped value

EndianSwap64

uint64_t EndianSwap64(uint64_t x)

swap bytes in a 64-bit value

PARAMETERS

uint64_t x Value to byte swap

RETURNS

uint64_t Byte-swapped value

EndianToHost16

uint16_t EndianToHost16(uint16_t x)

Network byte order is big-endian.

PARAMETERS

uint16_t x Network-order (big-endian) value

RETURNS

uint16_t Host-order value

EndianToHost32

uint32_t EndianToHost32(uint32_t x)

Network byte order is big-endian.

PARAMETERS

uint32_t x Network-order (big-endian) value

RETURNS

uint32_t Host-order value

EndianToHost64

uint64_t EndianToHost64(uint64_t x)

Network byte order is big-endian.

PARAMETERS

uint64_t x Network-order (big-endian) value

RETURNS

uint64_t Host-order value

EndianToNetwork16

uint16_t EndianToNetwork16(uint16_t x)

Network byte order is big-endian.

PARAMETERS

uint16_t x Host-order value

RETURNS

uint16_t Network-order (big-endian) value

EndianToNetwork32

uint32_t EndianToNetwork32(uint32_t x)

Network byte order is big-endian.

PARAMETERS

uint32_t x Host-order value

RETURNS

uint32_t Network-order (big-endian) value

EndianToNetwork64

uint64_t EndianToNetwork64(uint64_t x)

Network byte order is big-endian.

PARAMETERS

uint64_t x Host-order value

RETURNS

uint64_t Network-order (big-endian) value