Visual Servoing Platform  version 3.6.1 under development (2024-11-14)
vpEndian Namespace Reference

Functions

VISP_EXPORT uint16_t swap16bits (uint16_t val)
 
VISP_EXPORT uint32_t swap32bits (uint32_t val)
 
VISP_EXPORT float swapFloat (float f)
 
VISP_EXPORT double swapDouble (double d)
 
VISP_EXPORT uint16_t reinterpret_cast_uchar_to_uint16_LE (unsigned char *const ptr)
 

Function Documentation

◆ reinterpret_cast_uchar_to_uint16_LE()

uint16_t vpEndian::reinterpret_cast_uchar_to_uint16_LE ( unsigned char *const  ptr)

Reinterpret an array of unsigned char stored in a little-endian way into an uint16_t value.

Warning
Pointer must be valid and 16-bit must be correctly readable.
Examples
catchEndian.cpp.

Definition at line 134 of file vpEndian.cpp.

References swap16bits().

◆ swap16bits()

uint16_t vpEndian::swap16bits ( uint16_t  val)

Swap 16 bits by shifting to the right the first byte and by shifting to the left the second byte.

Examples
catchColorConversion.cpp.

Definition at line 49 of file vpEndian.cpp.

Referenced by vpIoTools::readBinaryValueLE(), reinterpret_cast_uchar_to_uint16_LE(), and vpIoTools::writeBinaryValueLE().

◆ swap32bits()

uint32_t vpEndian::swap32bits ( uint32_t  val)

Swap 32 bits by shifting to the right the first 2 bytes and by shifting to the left the last 2 bytes.

Definition at line 61 of file vpEndian.cpp.

Referenced by vpIoTools::readBinaryValueLE(), and vpIoTools::writeBinaryValueLE().

◆ swapDouble()

double vpEndian::swapDouble ( double  d)

Swap a double, the union is necessary because of the representation of a double in memory in IEEE 754.

Definition at line 101 of file vpEndian.cpp.

Referenced by vpIoTools::readBinaryValueLE(), and vpIoTools::writeBinaryValueLE().

◆ swapFloat()

float vpEndian::swapFloat ( float  f)

Swap a float, the union is necessary because of the representation of a float in memory in IEEE 754.

Definition at line 77 of file vpEndian.cpp.

Referenced by vpIoTools::readBinaryValueLE(), and vpIoTools::writeBinaryValueLE().