mal-packet-weaver
C++20 packet serialization/deserialization library.
Loading...
Searching...
No Matches
endianness.hpp File Reference

Provides functions and utilities for handling endianness conversions. More...

#include <emmintrin.h>
#include <immintrin.h>
#include <smmintrin.h>
#include <tmmintrin.h>
#include <bit>
#include "../library-pch.hpp"
Include dependency graph for endianness.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  mal_toolkit
 Contains a collection of tools and utilities provided by the MAL Toolkit library.
 
namespace  mal_toolkit::endianness
 

Macros

#define MAL_TOOLKIT_DETAIL_ENDIANNES_ICC   0
 
#define MAL_TOOLKIT_DETAIL_ENDIANNES_GCC   0
 
#define MAL_TOOLKIT_DETAIL_ENDIANNES_MSVC   0
 

Enumerations

enum class  mal_toolkit::endianness::CompilerType : uint32_t { mal_toolkit::endianness::kUnknown = 1 << 0 , mal_toolkit::endianness::kGCC = 1 << 1 , mal_toolkit::endianness::kMSVC = 1 << 2 , mal_toolkit::endianness::kICC = 1 << 3 }
 Ensures that the determined endianness is valid. More...
 

Functions

constexpr bool mal_toolkit::endianness::is_big_endian ()
 Determines if the system's native endianness is big-endian.
 
constexpr bool mal_toolkit::endianness::is_little_endian ()
 Determines if the system's native endianness is little-endian.
 
constexpr uint32_t mal_toolkit::endianness::compiler_type ()
 Determines the compiler type used to compile the code.
 
constexpr bool mal_toolkit::endianness::is_compiler_icc ()
 Checks if the code was compiled with ICC (Intel C++ Compiler).
 
constexpr bool mal_toolkit::endianness::is_compiler_gcc ()
 Checks if the code was compiled with GCC (GNU Compiler Collection).
 
constexpr bool mal_toolkit::endianness::is_compiler_msvc ()
 Checks if the code was compiled with MSVC (Microsoft Visual C++).
 
uint16_t mal_toolkit::endianness::betole16 (uint16_t x)
 Converts a 16-bit value between big-endian and little-endian.
 
uint32_t mal_toolkit::endianness::betole32 (uint32_t x)
 Converts a 32-bit value between big-endian and little-endian.
 
uint64_t mal_toolkit::endianness::betole64 (uint64_t x)
 Converts a 64-bit value between big-endian and little-endian.
 
__m128i mal_toolkit::endianness::betole128 (__m128i x)
 Converts a 128-bit value between big-endian and little-endian using SSE2 intrinsics.
 
__m256i mal_toolkit::endianness::betole256 (__m256i x)
 Converts a 256-bit value between big-endian and little-endian using AVX2 intrinsics.
 

Variables

constexpr bool mal_toolkit::endianness::kIsBigEndian = is_big_endian()
 Represents the determined endianness of the system.
 
constexpr bool mal_toolkit::endianness::kIsLittleEndian = is_little_endian()
 Represents the determined endianness of the system.
 
constexpr uint32_t mal_toolkit::endianness::kCompilerType = compiler_type()
 Indicates the compiler type used for the code.
 

Detailed Description

Provides functions and utilities for handling endianness conversions.

Definition in file endianness.hpp.

Macro Definition Documentation

◆ MAL_TOOLKIT_DETAIL_ENDIANNES_GCC

#define MAL_TOOLKIT_DETAIL_ENDIANNES_GCC   0

◆ MAL_TOOLKIT_DETAIL_ENDIANNES_ICC

#define MAL_TOOLKIT_DETAIL_ENDIANNES_ICC   0

◆ MAL_TOOLKIT_DETAIL_ENDIANNES_MSVC

#define MAL_TOOLKIT_DETAIL_ENDIANNES_MSVC   0