7#include "../utility/utility.hpp"
8#include "../macros.hpp"
38namespace hi {
inline namespace v1 {
41enum class native_rounding_mode :
int {
42 nearest = _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC,
43 negative_infinite = _MM_FROUND_TO_NEG_INF | _MM_FROUND_NO_EXC,
44 positive_infinite = _MM_FROUND_TO_POS_INF | _MM_FROUND_NO_EXC,
45 truncate = _MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC,
49 current = _MM_FROUND_CUR_DIRECTION
69template<fixed_
string SourceElements,
size_t NumElements>
70[[nodiscard]]
constexpr size_t native_swizzle_to_packed_indices() noexcept
72 constexpr auto max_elements =
sizeof(size_t) == 8 ? 16 : 8;
73 static_assert(NumElements > 1 and NumElements <= max_elements and std::has_single_bit(NumElements));
74 static_assert(SourceElements.size() <= NumElements);
76 constexpr auto shift = std::bit_width(NumElements - 1);
83 for (; i != SourceElements.size(); --i) {
89 hilet c = SourceElements[i - 1];
92 if (c >=
'0' and c <=
'9') {
96 }
else if (c >=
'a' and c <=
'p') {
99 }
else if (c >=
'x' and c <=
'z') {
102 }
else if (c ==
'w') {
124template<fixed_
string SourceElements,
size_t NumElements,
char Value>
125[[nodiscard]]
constexpr size_t native_swizzle_to_mask() noexcept
127 static_assert(NumElements > 1 and NumElements <=
sizeof(size_t) * CHAR_BIT and std::has_single_bit(NumElements));
128 static_assert(SourceElements.size() <= NumElements);
132 auto i = NumElements;
135 for (; i != SourceElements.size(); --i) {
140 for (; i != 0; --i) {
141 hilet c = SourceElements[i - 1];
161template<
typename T,
size_t N>
166template<
typename T,
size_t N>
170 return equal(lhs, rhs);
174namespace testing::internal {
177template<
typename T,
size_t N>
184template<
typename T,
size_t N>
185inline bool operator!=(::hi::native_simd<T, N> lhs, ::hi::native_simd<T, N> rhs)
noexcept
187 return not std::equal_to<::hi::native_simd<T, N>>{}(lhs, rhs);
@ current
Continue from the current position.
Definition seek_whence.hpp:16
@ shift
The shift key is being held.
Definition keyboard_modifiers.hpp:23
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
The HikoGUI API version 1.
Definition lookahead_iterator.hpp:6
constexpr Out char_cast(In rhs) noexcept
Cast a character.
Definition cast.hpp:550
constexpr Out truncate(In rhs) noexcept
Cast between integral types truncating or zero-extending the result.
Definition cast.hpp:534
constexpr Out wide_cast(In const &rhs) noexcept
Cast to a type which can hold all values from the input type.
Definition cast.hpp:175
A native-SIMD type.
Definition native_simd_utility.hpp:162