Skip to content

Commit 7aa01a3

Browse files
authored
Merge branch 'tip-of-tree' into add-threadpool
2 parents 1747cdb + af07efd commit 7aa01a3

7 files changed

Lines changed: 69 additions & 436 deletions

File tree

.github/workflows/build-and-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
matrix:
3838
platform: [X86-64] # TODO: Add X86, AArch32, and AArch64 platforms
3939
compiler: [clang++, g++]
40-
runner: [ubuntu-22.04, ubuntu-20.04]
40+
runner: [ubuntu-24.04]
4141
runs-on: ${{ matrix.runner }}
4242

4343
steps:

Code/max/Algorithms/SwapEndian.hpp

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <max/Compiling/CurrentVersionNamespace.hpp>
99
#include <max/Compiling/AliasingOptimizations.hpp>
1010
#include <cstdint>
11+
#include <concepts>
1112

1213
namespace max
1314
{
@@ -16,47 +17,17 @@ MAX_CURRENT_VERSION_NAMESPACE_BEGIN( v0 )
1617
namespace Algorithms
1718
{
1819

19-
MAX_PURE_DECLARATION( inline uint64_t SwapEndian( const uint64_t Value ) noexcept );
20-
MAX_PURE_DECLARATION( inline uint32_t SwapEndian( const uint32_t Value ) noexcept );
21-
MAX_PURE_DECLARATION( inline uint16_t SwapEndian( const uint16_t Value ) noexcept );
22-
MAX_PURE_DECLARATION( inline int64_t SwapEndian( const int64_t Value ) noexcept );
23-
MAX_PURE_DECLARATION( inline int32_t SwapEndian( const int32_t Value ) noexcept );
24-
MAX_PURE_DECLARATION( inline int16_t SwapEndian( const int16_t Value ) noexcept );
20+
template <std::integral T>
21+
MAX_PURE_DECLARATION( constexpr inline T LittleEndianToHost(const T Value ) noexcept );
2522

26-
MAX_PURE_DECLARATION( constexpr inline uint64_t SwapEndianConstexpr( const uint64_t Value ) noexcept );
27-
MAX_PURE_DECLARATION( constexpr inline uint32_t SwapEndianConstexpr( const uint32_t Value ) noexcept );
28-
MAX_PURE_DECLARATION( constexpr inline uint16_t SwapEndianConstexpr( const uint16_t Value ) noexcept );
29-
MAX_PURE_DECLARATION( constexpr inline int64_t SwapEndianConstexpr( const int64_t Value ) noexcept );
30-
MAX_PURE_DECLARATION( constexpr inline int32_t SwapEndianConstexpr( const int32_t Value ) noexcept );
31-
MAX_PURE_DECLARATION( constexpr inline int16_t SwapEndianConstexpr( const int16_t Value ) noexcept );
23+
template <std::integral T>
24+
MAX_PURE_DECLARATION( constexpr inline T BigEndianToHost( const T Value ) noexcept );
3225

33-
MAX_PURE_DECLARATION( constexpr inline uint64_t LittleEndianToHost( const uint64_t Value ) noexcept );
34-
MAX_PURE_DECLARATION( constexpr inline uint32_t LittleEndianToHost( const uint32_t Value ) noexcept );
35-
MAX_PURE_DECLARATION( constexpr inline uint16_t LittleEndianToHost( const uint16_t Value ) noexcept );
36-
MAX_PURE_DECLARATION( constexpr inline int64_t LittleEndianToHost( const int64_t Value ) noexcept );
37-
MAX_PURE_DECLARATION( constexpr inline int32_t LittleEndianToHost( const int32_t Value ) noexcept );
38-
MAX_PURE_DECLARATION( constexpr inline int16_t LittleEndianToHost( const int16_t Value ) noexcept );
26+
template <std::integral T>
27+
MAX_PURE_DECLARATION( constexpr inline T HostToLittleEndian( const T Value ) noexcept );
3928

40-
MAX_PURE_DECLARATION( constexpr inline uint64_t BigEndianToHost( const uint64_t Value ) noexcept );
41-
MAX_PURE_DECLARATION( constexpr inline uint32_t BigEndianToHost( const uint32_t Value ) noexcept );
42-
MAX_PURE_DECLARATION( constexpr inline uint16_t BigEndianToHost( const uint16_t Value ) noexcept );
43-
MAX_PURE_DECLARATION( constexpr inline int64_t BigEndianToHost( const int64_t Value ) noexcept );
44-
MAX_PURE_DECLARATION( constexpr inline int32_t BigEndianToHost( const int32_t Value ) noexcept );
45-
MAX_PURE_DECLARATION( constexpr inline int16_t BigEndianToHost( const int16_t Value ) noexcept );
46-
47-
MAX_PURE_DECLARATION( constexpr inline uint64_t HostToLittleEndian( const uint64_t Value ) noexcept );
48-
MAX_PURE_DECLARATION( constexpr inline uint32_t HostToLittleEndian( const uint32_t Value ) noexcept );
49-
MAX_PURE_DECLARATION( constexpr inline uint16_t HostToLittleEndian( const uint16_t Value ) noexcept );
50-
MAX_PURE_DECLARATION( constexpr inline int64_t HostToLittleEndian( const int64_t Value ) noexcept );
51-
MAX_PURE_DECLARATION( constexpr inline int32_t HostToLittleEndian( const int32_t Value ) noexcept );
52-
MAX_PURE_DECLARATION( constexpr inline int16_t HostToLittleEndian( const int16_t Value ) noexcept );
53-
54-
MAX_PURE_DECLARATION( constexpr inline uint64_t HostToBigEndian( const uint64_t Value ) noexcept );
55-
MAX_PURE_DECLARATION( constexpr inline uint32_t HostToBigEndian( const uint32_t Value ) noexcept );
56-
MAX_PURE_DECLARATION( constexpr inline uint16_t HostToBigEndian( const uint16_t Value ) noexcept );
57-
MAX_PURE_DECLARATION( constexpr inline int64_t HostToBigEndian( const int64_t Value ) noexcept );
58-
MAX_PURE_DECLARATION( constexpr inline int32_t HostToBigEndian( const int32_t Value ) noexcept );
59-
MAX_PURE_DECLARATION( constexpr inline int16_t HosttoBigEndian( const int16_t Value ) noexcept );
29+
template <std::integral T>
30+
MAX_PURE_DECLARATION( constexpr inline T HostToBigEndian( const T Value ) noexcept );
6031

6132
MAX_PURE_DECLARATION( constexpr inline uint64_t CombinePieces( const uint8_t First8Bits,
6233
const uint8_t Second8Bits,

0 commit comments

Comments
 (0)