42template <
int a,
int b,
int c,
int d>
44 static const uint32_t
Value = (((((d << 8) | c) << 8) | b) << 8) | a;
56template <
typename... Args>
58 (void)(
sizeof...(args));
72inline uint32_t
CRC32(
const void *data,
size_t length, uint32_t crc = 0) {
73 const uint8_t *ldata = (
const uint8_t *)data;
78 for (uint8_t k = 0; k < 8; k++)
79 crc = crc & 1 ? (crc >> 1) ^ 0x82f63b78 : crc >> 1;
88#define COUNT_OF(arr) (sizeof(arr) / sizeof(arr[0]))
97#define ARRAY_ELEMENT_SAFE(arr, index) ((arr)[(((index) < COUNT_OF(arr)) ? (index) : (COUNT_OF(arr) - 1))])
107#define FOURCC(name) FourCC<ARRAY_ELEMENT_SAFE(#name, 0), ARRAY_ELEMENT_SAFE(#name, 1), ARRAY_ELEMENT_SAFE(#name, 2), ARRAY_ELEMENT_SAFE(#name, 3)>::Value
119#define ALIAS_IMPLICIT_FUNCTION(high, low) \
120 template <typename... Args> \
121 inline auto high(Args &&...args) -> decltype(low(std::forward<Args>(args)...)) { \
122 return low(std::forward<Args>(args)...); \
134#define ALIAS_EXPLICIT_FUNCTION(high, low) \
135 template <typename T, typename... Args> \
136 inline auto high(Args &&...args) -> decltype(low<T>(std::forward<Args>(args)...)) { \
137 return low<T>(std::forward<Args>(args)...); \
168template <
typename T_First,
typename T_Second>
169using Pair = std::pair<T_First, T_Second>;
auto MakePair(Args &&...args) -> decltype(std::make_pair(std::forward< Args >(args)...))
Creates a pair instance, alias for std::make_pair.
Definition Common.h:184
std::unique_ptr< T > UniquePointer
Type alias for std::unique_ptr with cleaner syntax.
Definition Common.h:152
#define ALIAS_IMPLICIT_FUNCTION(high, low)
Creates an alias for a function that forwards all arguments implicitly.
Definition Common.h:119
std::shared_ptr< T > SharedPointer
Type alias for std::shared_ptr with cleaner syntax.
Definition Common.h:160
void UNUSED(Args &&...args)
Utility function to mark function parameters as intentionally unused.
Definition Common.h:57
std::pair< T_First, T_Second > Pair
Type alias for std::pair with cleaner syntax.
Definition Common.h:169
auto MakeUnique(Args &&...args) -> decltype(std::make_unique< T >(std::forward< Args >(args)...))
Creates a unique pointer instance, alias for std::make_unique.
Definition Common.h:179
#define ALIAS_EXPLICIT_FUNCTION(high, low)
Creates an alias for a template function that forwards all arguments explicitly.
Definition Common.h:134
uint32_t CRC32(const void *data, size_t length, uint32_t crc=0)
Calculates CRC32-C (Castagnoli) checksum for data integrity verification.
Definition Common.h:72
auto MakeShared(Args &&...args) -> decltype(std::make_shared< T >(std::forward< Args >(args)...))
Creates a shared pointer instance, alias for std::make_shared.
Definition Common.h:174
Contains all classes and functions related to the Uniot Core.
Creates a four-character code (FourCC) value from template parameters.
Definition Common.h:43
static const uint32_t Value
Definition Common.h:44