Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 9 additions & 38 deletions Code/max/Algorithms/SwapEndian.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <max/Compiling/CurrentVersionNamespace.hpp>
#include <max/Compiling/AliasingOptimizations.hpp>
#include <cstdint>
#include <concepts>

namespace max
{
Expand All @@ -16,47 +17,17 @@ MAX_CURRENT_VERSION_NAMESPACE_BEGIN( v0 )
namespace Algorithms
{

MAX_PURE_DECLARATION( inline uint64_t SwapEndian( const uint64_t Value ) noexcept );
MAX_PURE_DECLARATION( inline uint32_t SwapEndian( const uint32_t Value ) noexcept );
MAX_PURE_DECLARATION( inline uint16_t SwapEndian( const uint16_t Value ) noexcept );
MAX_PURE_DECLARATION( inline int64_t SwapEndian( const int64_t Value ) noexcept );
MAX_PURE_DECLARATION( inline int32_t SwapEndian( const int32_t Value ) noexcept );
MAX_PURE_DECLARATION( inline int16_t SwapEndian( const int16_t Value ) noexcept );
template <std::integral T>
MAX_PURE_DECLARATION( constexpr inline T LittleEndianToHost(const T Value ) noexcept );

MAX_PURE_DECLARATION( constexpr inline uint64_t SwapEndianConstexpr( const uint64_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline uint32_t SwapEndianConstexpr( const uint32_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline uint16_t SwapEndianConstexpr( const uint16_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int64_t SwapEndianConstexpr( const int64_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int32_t SwapEndianConstexpr( const int32_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int16_t SwapEndianConstexpr( const int16_t Value ) noexcept );
template <std::integral T>
MAX_PURE_DECLARATION( constexpr inline T BigEndianToHost( const T Value ) noexcept );

MAX_PURE_DECLARATION( constexpr inline uint64_t LittleEndianToHost( const uint64_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline uint32_t LittleEndianToHost( const uint32_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline uint16_t LittleEndianToHost( const uint16_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int64_t LittleEndianToHost( const int64_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int32_t LittleEndianToHost( const int32_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int16_t LittleEndianToHost( const int16_t Value ) noexcept );
template <std::integral T>
MAX_PURE_DECLARATION( constexpr inline T HostToLittleEndian( const T Value ) noexcept );

MAX_PURE_DECLARATION( constexpr inline uint64_t BigEndianToHost( const uint64_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline uint32_t BigEndianToHost( const uint32_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline uint16_t BigEndianToHost( const uint16_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int64_t BigEndianToHost( const int64_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int32_t BigEndianToHost( const int32_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int16_t BigEndianToHost( const int16_t Value ) noexcept );

MAX_PURE_DECLARATION( constexpr inline uint64_t HostToLittleEndian( const uint64_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline uint32_t HostToLittleEndian( const uint32_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline uint16_t HostToLittleEndian( const uint16_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int64_t HostToLittleEndian( const int64_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int32_t HostToLittleEndian( const int32_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int16_t HostToLittleEndian( const int16_t Value ) noexcept );

MAX_PURE_DECLARATION( constexpr inline uint64_t HostToBigEndian( const uint64_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline uint32_t HostToBigEndian( const uint32_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline uint16_t HostToBigEndian( const uint16_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int64_t HostToBigEndian( const int64_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int32_t HostToBigEndian( const int32_t Value ) noexcept );
MAX_PURE_DECLARATION( constexpr inline int16_t HosttoBigEndian( const int16_t Value ) noexcept );
template <std::integral T>
MAX_PURE_DECLARATION( constexpr inline T HostToBigEndian( const T Value ) noexcept );

MAX_PURE_DECLARATION( constexpr inline uint64_t CombinePieces( const uint8_t First8Bits,
const uint8_t Second8Bits,
Expand Down
Loading
Loading