libmicroemu
0.2.0
ARM Microcontroller Emulator Library
Loading...
Searching...
No Matches
src
libmicroemu
internal
utils
traits.h
1
#pragma once
2
#include "libmicroemu/types.h"
3
4
#include <cstddef>
5
#include <cstdint>
6
#include <type_traits>
7
8
namespace
libmicroemu::internal
{
9
10
template
<
typename
T>
struct
make_signed_type
;
11
12
template
<>
struct
make_signed_type
<u64> {
13
using
type = i64;
14
};
15
template
<>
struct
make_signed_type
<u32> {
16
using
type = i32;
17
};
18
19
template
<>
struct
make_signed_type
<u16> {
20
using
type = i16;
21
};
22
23
template
<>
struct
make_signed_type
<u8> {
24
using
type = i8;
25
};
26
27
template
<
typename
T>
using
make_signed_type_t =
typename
make_signed_type<T>::type
;
28
29
// ----------------------------------
30
31
template
<
typename
T>
struct
no_of_bits
;
32
33
template
<>
struct
no_of_bits
<u64> {
34
static
constexpr
u32 N = 64U;
35
};
36
37
template
<>
struct
no_of_bits
<u32> {
38
static
constexpr
u32 N = 32U;
39
};
40
41
template
<>
struct
no_of_bits
<u16> {
42
static
constexpr
u16 N = 16U;
43
};
44
45
template
<>
struct
no_of_bits
<u8> {
46
static
constexpr
u8 N = 8U;
47
};
48
49
template
<
typename
T>
struct
next_bigger_type
;
50
51
template
<>
struct
next_bigger_type
<u32> {
52
using
type = u64;
53
};
54
55
template
<>
struct
next_bigger_type
<u16> {
56
using
type = u32;
57
};
58
59
template
<>
struct
next_bigger_type
<u8> {
60
using
type = u16;
61
};
62
63
// Alias for easy use
64
template
<
typename
T>
using
next_bigger_type_t =
typename
next_bigger_type<T>::type
;
65
66
}
// namespace libmicroemu::internal
libmicroemu::internal
The libmicroemu::internal namespace contains all classes and functions of libmicroemu which are priva...
Definition
bkpt_flags.h:6
libmicroemu::internal::make_signed_type
Definition
traits.h:10
libmicroemu::internal::next_bigger_type
Definition
traits.h:49
libmicroemu::internal::no_of_bits
Definition
traits.h:31
Generated by
1.13.2