HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
stdint.hpp
Go to the documentation of this file.
1// Copyright Take Vos 2022.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "architecture.hpp"
8
9#if (HI_COMPILER == HI_CC_GCC || HI_COMPILER == HI_CC_CLANG) && (HI_PROCESSOR == HI_CPU_X64 || HI_PROCESSOR == HI_CPU_ARM64)
10#define HI_HAS_INT128 1
11#endif
12
13#if !defined(HI_HAS_INT128)
14#include "bigint.hpp"
15#endif
16#include <cstdint>
17
36namespace hi::inline v1 {
37
38#if HI_PROCESSOR == HI_CPU_X86
39
42using intreg_t = int32_t;
43
46using uintreg_t = uint32_t;
47
48#elif HI_PROCESSOR == HI_CPU_X64
49
52using intreg_t = int64_t;
53
56using uintreg_t = uint64_t;
57
58#elif HI_PROCESS = HI_CPU_ARM
59
62using intreg_t = int32_t;
63
66using uintreg_t = uint32_t;
67
68#elif HI_PROCESS = HI_CPU_ARM64
69
72using intreg_t = int64_t;
73
76using uintreg_t = uint64_t;
77
78#else
79#error "intreg_t uintreg_t missing implementation"
80#endif
81
82#if defined(HI_HAS_INT128)
83
86using int128_t = __int128_t;
87
90using uint128_t = unsigned __int128_t;
91
92#else
93
96using int128_t = bigint<uintreg_t, 128 / (sizeof(uintreg_t) * CHAR_BIT), true>;
97
100using uint128_t = bigint<uintreg_t, 128 / (sizeof(uintreg_t) * CHAR_BIT), false>;
101
102#endif
103
104#if HI_PROCESSOR == HI_CPU_X86
105
108using longreg_t = int64_t;
109
112using ulongreg_t = uint64_t;
113
114#elif HI_PROCESSOR == HI_CPU_X64
115
118using longreg_t = int128_t;
119
122using ulongreg_t = uint128_t;
123
124#elif HI_PROCESS = HI_CPU_ARM
125
128using longreg_t = int64_t;
129
132using ulongreg_t = uint64_t;
133
134#elif HI_PROCESS = HI_CPU_ARM64
135
138using longreg_t = int128_t;
139
142using ulongreg_t = uint128_t;
143
144#else
145#error "longreg_t ulongreg_t missing implementation"
146#endif
147
148} // namespace hi::inline v1
Functions and macros for handling architectural difference between compilers, CPUs and operating syst...
DOXYGEN BUG.
Definition algorithm.hpp:15
int64_t longreg_t
Signed integer twice the size of a standard CPU register.
Definition stdint.hpp:108
int32_t intreg_t
Signed integer the size of the standard CPU register.
Definition stdint.hpp:42
unsigned __int128_t uint128_t
Unsigned 128 bit integer.
Definition stdint.hpp:90
__int128_t int128_t
Signed 128 bit integer.
Definition stdint.hpp:86
uint64_t ulongreg_t
Unsigned integer twice the size of a standard CPU register.
Definition stdint.hpp:112
uint32_t uintreg_t
Signed integer the size of the standard CPU register.
Definition stdint.hpp:46
High performance big integer implementation.
Definition bigint.hpp:23