Mjolnir Core
Core functionality of the Mjolnir API
definitions.h
Go to the documentation of this file.
1 
7 
8 #pragma once
9 
11 #include <type_traits>
12 
13 #include <concepts>
14 
15 namespace mjolnir
16 {
19 
20 
26 // clang-format off
27 template <std::integral T_Type>
28 using EquallySizedUnsignedType = typename std::conditional_t<std::is_unsigned_v<T_Type>, T_Type,
29  std::conditional_t<std::is_same_v<T_Type, IPT>, UPT,
30  std::conditional_t<sizeof(T_Type) == 1, U8,
31  std::conditional_t<sizeof(T_Type) == 2, U16,
32  std::conditional_t<sizeof(T_Type) == 4, U32, U64>>>>>;
33 // clang-format on
34 
35 
41 template <typename T_Type>
42 concept Number = std::is_integral_v<T_Type> || std::is_floating_point_v<T_Type>;
43 
44 
46 } // namespace mjolnir
Defines the fundamental data types.
std::uintptr_t UPT
Unsigned integer type that has the same size as a pointer.
Definition: fundamental_types.h:30
std::uint32_t U32
32 bit unsigned integer type
Definition: fundamental_types.h:27
std::uint16_t U16
16 bit unsigned integer type
Definition: fundamental_types.h:26
std::uint64_t U64
64 bit unsigned integer type
Definition: fundamental_types.h:28
std::uint8_t U8
8 bit unsigned integer type
Definition: fundamental_types.h:25
concept Number
Concept for a number type.
Definition: definitions.h:42
typename std::conditional_t< std::is_unsigned_v< T_Type >, T_Type, std::conditional_t< std::is_same_v< T_Type, IPT >, UPT, std::conditional_t< sizeof(T_Type)==1, U8, std::conditional_t< sizeof(T_Type)==2, U16, std::conditional_t< sizeof(T_Type)==4, U32, U64 > >> >> EquallySizedUnsignedType
Unsigned integer type with the same size as the reference type.
Definition: definitions.h:32