HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
architecture.hpp
1// Copyright Take Vos 2019-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
9
10#pragma once
11
12#include "../macros.hpp"
13
14#include <exception>
15#include <cstddef>
16#include <type_traits>
17#include <stdint.h>
18#if defined(__APPLE__)
19#include <TargetConditionals.h>
20#endif
21#if HI_OPERATING_SYSTEM == HI_OS_LINUX || HI_OPERATING_SYSTEM == HI_OS_MACOS
22#include <sched.h>
23#endif
24
25hi_export_module(hikogui.utility.architecture);
26
27hi_export namespace hi::inline v1 {
28
29
30#if (HI_COMPILER == HI_CC_GCC || HI_COMPILER == HI_CC_CLANG)
31#if (HI_PROCESSOR == HI_CPU_X86_64 || HI_PROCESSOR == HI_CPU_ARM64)
32#if (HI_STD_LIBRARY == HI_STL_GCC || HI_STD_LIBRARY == HI_STL_LLVM)
33#define HI_HAS_INT128 1
34
37using int128_t = __int128;
38
41using uint128_t = unsigned __int128;
42
43#endif
44#endif
45#endif
46
47#if HI_OPERATING_SYSTEM == HI_OS_WINDOWS
48using os_handle = void *;
49//using file_handle = os_handle;
50using thread_id = uint32_t;
51constexpr std::size_t maximum_num_cpus = 64;
52
53#elif HI_OPERATING_SYSTEM == HI_OS_MACOS
54using os_handle = int;
55//using file_handle = int;
56using thread_id = uint32_t;
57constexpr std::size_t maximum_num_cpus = CPU_SETSIZE;
58
59#elif HI_OPERATING_SYSTEM == HI_OS_LINUX
60using os_handle = int;
61//using file_handle = int;
62using thread_id = uint32_t;
63constexpr std::size_t maximum_num_cpus = CPU_SETSIZE;
64
65#else
66#error "Not implemented."
67#endif
68
69
70} // namespace hi::inline v1
71
72namespace std {
73
74// Due to a bug in clang it will emit a undefined symbol to _Literal_zero_is_expected()
75// Which is only called from a consteval function (which should never emit code, ever).
76#if defined(__clang__) and defined(_CPPLIB_VER)
77inline void _Literal_zero_is_expected(void)
78{
80}
81#endif
82
83}
STL namespace.
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
__int128 int128_t
Signed 128 bit integer.
Definition architecture.hpp:37
unsigned __int128 uint128_t
Unsigned 128 bit integer.
Definition architecture.hpp:41
T terminate(T... args)