Direct-BT  2.3.1
Direct-BT - Direct Bluetooth Programming.
Classes | Namespaces | Enumerations | Functions | Variables
byte_util.hpp File Reference
#include <cstring>
#include <string>
#include <memory>
#include <cstdint>
#include <vector>
#include <type_traits>
#include <jau/cpp_lang_util.hpp>
#include <jau/cpp_pragma.hpp>
#include <jau/packed_attribute.hpp>
#include <jau/int_types.hpp>
Include dependency graph for byte_util.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  jau::has_endian_little< Dummy_type >
 A little-endian type trait for convenience . More...
 
struct  jau::has_endian_big< Dummy_type >
 A big-endian type trait for convenience . More...
 
struct  jau::packed_t< T >
 Safe access to a pointer cast from unaligned memory via packed attribute, i.e. More...
 

Namespaces

 jau
 
 jau::impl
 

Enumerations

enum  jau::endian : uint32_t {
  jau::endian::little = 0x41424344U, jau::endian::big = 0x44434241U, jau::endian::pdp = 0x43444142U, jau::endian::honeywell = 0x42414443U,
  jau::endian::undefined = 0x00000000U, jau::endian::native = impl::get_host_order()
}
 Endian identifier, indicating endianess of all scaler types. More...
 

Functions

constexpr uint16_t jau::bswap (uint16_t const source) noexcept
 
constexpr uint32_t jau::bswap (uint32_t const source) noexcept
 
constexpr uint64_t jau::bswap (uint64_t const &source) noexcept
 
constexpr uint128_t jau::bswap (uint128_t const &source) noexcept
 
constexpr uint192_t jau::bswap (uint192_t const &source) noexcept
 
constexpr uint256_t jau::bswap (uint256_t const &source) noexcept
 
constexpr uint32_t jau::impl::get_host_order () noexcept
 
PRAGMA_DISABLE_WARNING_POP constexpr_cxx20 std::string jau::to_string (const endian &v) noexcept
 Return std::string representation of the given jau::endian. More...
 
constexpr bool jau::isDefinedEndian (const endian &v) noexcept
 Evaluates true if the given endian is defined, i.e. More...
 
constexpr bool jau::isLittleEndian () noexcept
 Evaluates true if platform is running in little endian mode, i.e. More...
 
constexpr bool jau::isBigEndian () noexcept
 Evaluates true if platform is running in big endian mode, i.e. More...
 
constexpr bool jau::isLittleOrBigEndian () noexcept
 Evaluates true if platform is running in little or big endian mode, i.e. More...
 
constexpr uint16_t jau::be_to_cpu (uint16_t const n) noexcept
 On the i386 the host byte order is Least Significant Byte first (LSB) or Little-Endian, whereas the network byte order, as used on the Internet, is Most Significant Byte first (MSB) or Big-Endian. More...
 
constexpr uint16_t jau::cpu_to_be (uint16_t const h) noexcept
 
constexpr uint16_t jau::le_to_cpu (uint16_t const l) noexcept
 
constexpr uint16_t jau::cpu_to_le (uint16_t const h) noexcept
 
constexpr uint32_t jau::be_to_cpu (uint32_t const n) noexcept
 
constexpr uint32_t jau::cpu_to_be (uint32_t const h) noexcept
 
constexpr uint32_t jau::le_to_cpu (uint32_t const l) noexcept
 
constexpr uint32_t jau::cpu_to_le (uint32_t const h) noexcept
 
constexpr uint64_t jau::be_to_cpu (uint64_t const &n) noexcept
 
constexpr uint64_t jau::cpu_to_be (uint64_t const &h) noexcept
 
constexpr uint64_t jau::le_to_cpu (uint64_t const &l) noexcept
 
constexpr uint64_t jau::cpu_to_le (uint64_t const &h) noexcept
 
constexpr uint128_t jau::be_to_cpu (uint128_t const &n) noexcept
 
constexpr uint128_t jau::cpu_to_be (uint128_t const &h) noexcept
 
constexpr uint128_t jau::le_to_cpu (uint128_t const &l) noexcept
 
constexpr uint128_t jau::cpu_to_le (uint128_t const &h) noexcept
 
constexpr uint192_t jau::be_to_cpu (uint192_t const &n) noexcept
 
constexpr uint192_t jau::cpu_to_be (uint192_t const &h) noexcept
 
constexpr uint192_t jau::le_to_cpu (uint192_t const &l) noexcept
 
constexpr uint192_t jau::cpu_to_le (uint192_t const &h) noexcept
 
constexpr uint256_t jau::be_to_cpu (uint256_t const &n) noexcept
 
constexpr uint256_t jau::cpu_to_be (uint256_t const &h) noexcept
 
constexpr uint256_t jau::le_to_cpu (uint256_t const &l) noexcept
 
constexpr uint256_t jau::cpu_to_le (uint256_t const &h) noexcept
 
constexpr void jau::put_uint8 (uint8_t *buffer, nsize_t const byte_offset, const uint8_t v) noexcept
 
constexpr uint8_t jau::get_uint8 (uint8_t const *buffer, nsize_t const byte_offset) noexcept
 
constexpr int8_t jau::get_int8 (uint8_t const *buffer, nsize_t const byte_offset) noexcept
 
constexpr void jau::put_uint16 (uint8_t *buffer, nsize_t const byte_offset, const uint16_t v) noexcept
 
constexpr void jau::put_uint16 (uint8_t *buffer, nsize_t const byte_offset, const uint16_t v, const bool littleEndian) noexcept
 
constexpr uint16_t jau::get_uint16 (uint8_t const *buffer, nsize_t const byte_offset) noexcept
 
constexpr uint16_t jau::get_uint16 (uint8_t const *buffer, nsize_t const byte_offset, const bool littleEndian) noexcept
 
constexpr void jau::put_uint32 (uint8_t *buffer, nsize_t const byte_offset, const uint32_t v) noexcept
 
constexpr void jau::put_uint32 (uint8_t *buffer, nsize_t const byte_offset, const uint32_t v, const bool littleEndian) noexcept
 
constexpr uint32_t jau::get_uint32 (uint8_t const *buffer, nsize_t const byte_offset) noexcept
 
constexpr uint32_t jau::get_uint32 (uint8_t const *buffer, nsize_t const byte_offset, const bool littleEndian) noexcept
 
constexpr void jau::put_uint64 (uint8_t *buffer, nsize_t const byte_offset, const uint64_t &v) noexcept
 
constexpr void jau::put_uint64 (uint8_t *buffer, nsize_t const byte_offset, const uint64_t &v, const bool littleEndian) noexcept
 
constexpr uint64_t jau::get_uint64 (uint8_t const *buffer, nsize_t const byte_offset) noexcept
 
constexpr uint64_t jau::get_uint64 (uint8_t const *buffer, nsize_t const byte_offset, const bool littleEndian) noexcept
 
constexpr void jau::put_uint128 (uint8_t *buffer, nsize_t const byte_offset, const uint128_t &v) noexcept
 
constexpr void jau::put_uint128 (uint8_t *buffer, nsize_t const byte_offset, const uint128_t &v, const bool littleEndian) noexcept
 
constexpr uint128_t jau::get_uint128 (uint8_t const *buffer, nsize_t const byte_offset) noexcept
 
constexpr uint128_t jau::get_uint128 (uint8_t const *buffer, nsize_t const byte_offset, const bool littleEndian) noexcept
 
constexpr void jau::put_uint192 (uint8_t *buffer, nsize_t const byte_offset, const uint192_t &v) noexcept
 
constexpr void jau::put_uint192 (uint8_t *buffer, nsize_t const byte_offset, const uint192_t &v, const bool littleEndian) noexcept
 
constexpr uint192_t jau::get_uint192 (uint8_t const *buffer, nsize_t const byte_offset) noexcept
 
constexpr uint192_t jau::get_uint192 (uint8_t const *buffer, nsize_t const byte_offset, const bool littleEndian) noexcept
 
constexpr void jau::put_uint256 (uint8_t *buffer, nsize_t const byte_offset, const uint256_t &v) noexcept
 
constexpr void jau::put_uint256 (uint8_t *buffer, nsize_t const byte_offset, const uint256_t &v, const bool littleEndian) noexcept
 
constexpr uint256_t jau::get_uint256 (uint8_t const *buffer, nsize_t const byte_offset) noexcept
 
constexpr uint256_t jau::get_uint256 (uint8_t const *buffer, nsize_t const byte_offset, const bool littleEndian) noexcept
 
template<typename T >
constexpr std::enable_if_t< std::is_standard_layout_v< T >, void > jau::put_value (uint8_t *buffer, nsize_t const byte_offset, const T &v) noexcept
 
template<typename T >
constexpr std::enable_if_t< std::is_standard_layout_v< T >, void > jau::put_value (uint8_t *buffer, nsize_t const byte_offset, const T &v, const bool littleEndian) noexcept
 
template<typename T >
constexpr std::enable_if_t< std::is_standard_layout_v< T >, T > jau::get_value (uint8_t const *buffer, nsize_t const byte_offset) noexcept
 
template<typename T >
constexpr std::enable_if_t< std::is_standard_layout_v< T >, T > jau::get_value (uint8_t const *buffer, nsize_t const byte_offset, const bool littleEndian) noexcept
 

Variables

template<typename Dummy_type >
constexpr bool jau::has_endian_little_v = has_endian_little<Dummy_type>::value
 Value access of little-endian type trait for convenience . More...
 
template<typename Dummy_type >
constexpr bool jau::has_endian_big_v = has_endian_big<Dummy_type>::value
 Value access of big-endian type trait for convenience . More...