Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpEndian Namespace Reference

Functions

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

Function Documentation

◆ isBigEndian()

bool vpEndian::isBigEndian ( )

Return true if the executed code runs on a big-endian platform.

Examples
catchEndian.cpp.

Definition at line 175 of file vpEndian.cpp.

◆ 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 161 of file vpEndian.cpp.

References swap16bits().

◆ swap16bits()

◆ 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.

Examples
catchEndian.cpp.

Definition at line 60 of file vpEndian.cpp.

Referenced by visp::cnpy::npz_save(), visp::cnpy::npz_save(), visp::cnpy::parse_zip_footer(), vpIoTools::readBinaryValueLE(), vpIoTools::readBinaryValueLE(), vpIoTools::writeBinaryValueLE(), and vpIoTools::writeBinaryValueLE().

◆ swap64bits()

uint64_t vpEndian::swap64bits ( uint64_t val)

Swap 64 bits by shifting to the right the first 4 bytes and by shifting to the left the last 4 bytes.

Examples
catchEndian.cpp.

Definition at line 76 of file vpEndian.cpp.

◆ 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.

Examples
catchEndian.cpp.

Definition at line 128 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.

Examples
catchEndian.cpp.

Definition at line 104 of file vpEndian.cpp.

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