QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
LittleEndian Namespace Reference

Concepts

concept  Scalar
 

Typedefs

template<Scalar T>
using Bits = std::conditional_t< sizeof(T)==1, uint8_t, std::conditional_t< sizeof(T)==2, uint16_t, std::conditional_t< sizeof(T)==4, uint32_t, uint64_t > > >
 

Functions

template<Scalar T>
constexpr std::optional< T > read (std::span< const uint8_t > bytes, std::size_t offset=0)
 Decode an unaligned little-endian scalar, returning nullopt when its bytes are unavailable.
 
template<Scalar T>
constexpr bool write (std::span< uint8_t > bytes, std::size_t offset, T value)
 Encode an unaligned little-endian scalar. Insufficient space leaves the destination unchanged.
 

Typedef Documentation

◆ Bits

template<Scalar T>
using LittleEndian::Bits = typedef std::conditional_t< sizeof(T) == 1, uint8_t, std::conditional_t<sizeof(T) == 2, uint16_t, std::conditional_t<sizeof(T) == 4, uint32_t, uint64_t> >>

Definition at line 19 of file LittleEndian.h.

Function Documentation

◆ read()

template<Scalar T>
constexpr std::optional< T > LittleEndian::read ( std::span< const uint8_t >  bytes,
std::size_t  offset = 0 
)
constexpr

Decode an unaligned little-endian scalar, returning nullopt when its bytes are unavailable.

Definition at line 25 of file LittleEndian.h.

◆ write()

template<Scalar T>
constexpr bool LittleEndian::write ( std::span< uint8_t >  bytes,
std::size_t  offset,
T  value 
)
constexpr

Encode an unaligned little-endian scalar. Insufficient space leaves the destination unchanged.

Definition at line 41 of file LittleEndian.h.

Referenced by UBX::CheckedValsetBatch< Capacity >::append(), and Wire::detail::write().