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 "../utility/utility.hpp"
8#include "../macros.hpp"
9
10#if (HI_COMPILER == HI_CC_GCC || HI_COMPILER == HI_CC_CLANG) && (HI_PROCESSOR == HI_CPU_X64 || HI_PROCESSOR == HI_CPU_ARM64)
11#define HI_HAS_INT128 1
12#endif
13
14#if !defined(HI_HAS_INT128)
15#include "bigint.hpp"
16#endif
17#include <cstdint>
18
19
20
39namespace hi::inline v1 {
40
41#ifndef HI_HAS_INT128
42
45using int128_t = bigint<uintreg_t, 128 / (sizeof(uintreg_t) * CHAR_BIT), true>;
46
49using uint128_t = bigint<uintreg_t, 128 / (sizeof(uintreg_t) * CHAR_BIT), false>;
50
51// clang-format off
52template<> struct has_intxx<128> : std::true_type {};
53template<> struct has_uintxx<128> : std::true_type {};
54template<> struct make_uintxx<128> { using type = uint128_t; };
55template<> struct make_intxx<128> { using type = int128_t; };
56// clang-format on
57
58#endif
59
60#if HI_PROCESSOR == HI_CPU_X86 || HI_PROCESSOR == HI_CPU_ARM
61
64using longreg_t = int64_t;
65
68using ulongreg_t = uint64_t;
69
70#elif HI_PROCESSOR == HI_CPU_X64 || HI_PROCESSOR == HI_CPU_ARM64
71
74using longreg_t = int128_t;
75
78using ulongreg_t = uint128_t;
79
80#else
81#error "longreg_t ulongreg_t missing implementation"
82#endif
83
84} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm.hpp:16
int64_t longreg_t
Signed integer twice the size of a standard CPU register.
Definition stdint.hpp:64
__int128 int128_t
Signed 128 bit integer.
Definition architecture.hpp:54
unsigned __int128 uint128_t
Unsigned 128 bit integer.
Definition architecture.hpp:58
uint64_t ulongreg_t
Unsigned integer twice the size of a standard CPU register.
Definition stdint.hpp:68
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377