7#include "../utility/module.hpp"
35namespace hi {
inline namespace v1 {
38enum class native_rounding_mode :
int {
39 nearest = _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC,
40 negative_infinite = _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC,
41 positive_infinite = _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC,
42 truncate = _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC,
46 current = _MM_FROUND_CUR_DIRECTION
66template<fixed_
string SourceElements,
size_t NumElements>
67[[nodiscard]]
constexpr size_t native_swizzle_to_packed_indices() noexcept
69 constexpr auto max_elements =
sizeof(size_t) == 8 ? 16 : 8;
70 static_assert(NumElements > 1 and NumElements <= max_elements and std::has_single_bit(NumElements));
71 static_assert(SourceElements.size() <= NumElements);
73 constexpr auto shift = std::bit_width(NumElements - 1);
80 for (; i != SourceElements.size(); --i) {
86 hilet c = SourceElements[i - 1];
89 if (c >=
'0' and c <=
'9') {
93 }
else if (c >=
'a' and c <=
'p') {
94 r |= char_cast<size_t>(c -
'a');
96 }
else if (c >=
'x' and c <=
'z') {
97 r |= char_cast<size_t>(c -
'x');
99 }
else if (c ==
'w') {
121template<fixed_
string SourceElements,
size_t NumElements,
char Value>
122[[nodiscard]]
constexpr size_t native_swizzle_to_mask() noexcept
124 static_assert(NumElements > 1 and NumElements <=
sizeof(size_t) * CHAR_BIT and std::has_single_bit(NumElements));
125 static_assert(SourceElements.size() <= NumElements);
129 auto i = NumElements;
132 for (; i != SourceElements.size(); --i) {
134 r |= wide_cast<size_t>(Value ==
'0');
137 for (; i != 0; --i) {
138 hilet c = SourceElements[i - 1];
141 r |= wide_cast<size_t>(c == Value);
158template<
typename T,
size_t N>
163template<
typename T,
size_t N>
167 return equal(lhs, rhs);
171namespace testing::internal {
174template<
typename T,
size_t N>
181template<
typename T,
size_t N>
#define hi_no_default(...)
This part of the code should not be reachable, unless a programming bug.
Definition assert.hpp:264
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
@ current
Continue from the current position.
@ truncate
After the file has been opened, truncate it.
DOXYGEN BUG.
Definition algorithm.hpp:13
@ shift
The shift key is being held.
geometry/margins.hpp
Definition cache.hpp:11
A native-SIMD type.
Definition native_simd_utility.hpp:159