7#include "native_simd_utility.hpp"
8#include "../utility/utility.hpp"
9#include "../macros.hpp"
17hi_warning_ignore_msvc(26490);
19namespace hi {
inline namespace v1 {
40struct native_simd<uint32_t,4> {
41 using value_type = uint32_t;
42 constexpr static size_t size = 4;
48 native_simd(native_simd
const&)
noexcept =
default;
73 value_type b = value_type{0},
74 value_type c = value_type{0},
75 value_type d = value_type{0})
noexcept :
89 void store(value_type *out)
const noexcept
91 hi_axiom_not_null(out);
99 void store(
void *out)
const noexcept
101 hi_axiom_not_null(out);
105 [[
nodiscard]]
explicit native_simd(std::span<value_type const>
other)
noexcept
107 hi_axiom(
other.size() >= size);
111 void store(std::span<value_type> out)
const noexcept
113 hi_axiom(out.size() >= size);
124 auto r = array_type{};
173 hi_axiom(mask <= 0b1111);
175 constexpr auto ones_ = std::bit_cast<value_type>(0xffff'ffffU);
177 mask & 0b0001 ?
ones_ : 0, mask & 0b0010 ?
ones_ : 0, mask & 0b0100 ?
ones_ : 0, mask & 0b1000 ?
ones_ : 0};
187 [[
nodiscard]]
friend bool equal(native_simd a, native_simd b)
noexcept
189 return (a == b).mask() == 0b1111;
192 [[
nodiscard]]
friend native_simd operator==(native_simd a, native_simd b)
noexcept
202 [[
nodiscard]]
friend native_simd operator+(native_simd a)
noexcept
207 [[
nodiscard]]
friend native_simd operator+(native_simd a, native_simd b)
noexcept
212 [[
nodiscard]]
friend native_simd operator-(native_simd a, native_simd b)
noexcept
217 [[
nodiscard]]
friend native_simd operator*(native_simd a, native_simd b)
noexcept
222 [[
nodiscard]]
friend native_simd operator&(native_simd a, native_simd b)
noexcept
227 [[
nodiscard]]
friend native_simd operator|(native_simd a, native_simd b)
noexcept
232 [[
nodiscard]]
friend native_simd operator^(native_simd a, native_simd b)
noexcept
237 [[
nodiscard]]
friend native_simd operator~(native_simd a)
noexcept
244 [[
nodiscard]]
friend native_simd operator<<(native_simd a,
unsigned int b)
noexcept
246 hi_axiom_bounds(b,
sizeof(value_type) *
CHAR_BIT);
250 [[
nodiscard]]
friend native_simd operator>>(native_simd a,
unsigned int b)
noexcept
252 hi_axiom_bounds(b,
sizeof(value_type) *
CHAR_BIT);
256 [[
nodiscard]]
friend native_simd
min(native_simd a, native_simd b)
noexcept
261 [[
nodiscard]]
friend native_simd
max(native_simd a, native_simd b)
noexcept
272 template<
size_t Mask>
275 static_assert(
Mask <= 0b1111);
291 template<
size_t Index>
292 [[
nodiscard]]
friend native_simd insert(native_simd a, value_type b)
noexcept
294 static_assert(
Index < 4);
310 template<
size_t Index>
311 [[
nodiscard]]
friend value_type get(native_simd a)
noexcept
316 auto r =
static_cast<array_type
>(a);
317 return std::get<Index>(r);
329 template<
size_t Mask>
330 [[
nodiscard]]
friend native_simd
blend(native_simd a, native_simd b)
noexcept
336 return not_and(mask, a) | (mask & b);
352 template<fixed_
string SourceElements>
355 constexpr auto order = detail::native_swizzle_to_packed_indices<SourceElements, size>();
357 if constexpr (
order == 0b11'10'01'00) {
359 }
else if constexpr (
order == 0b00'00'00'00) {
382 template<fixed_
string SourceElements>
385 constexpr auto one_mask = detail::native_swizzle_to_mask<SourceElements, size, '1'>();
386 constexpr auto zero_mask = detail::native_swizzle_to_mask<SourceElements, size, '0'>();
462 [[
nodiscard]]
friend native_simd
not_and(native_simd a, native_simd b)
noexcept
472 template<fixed_
string SourceElements>
475 constexpr auto one_mask = detail::native_swizzle_to_mask<SourceElements, size, '1'>();
476 constexpr auto zero_mask = detail::native_swizzle_to_mask<SourceElements, size, '0'>();
491 to_bool(
one_mask & 0b1000) ? 1 : 0};
@ other
The gui_event does not have associated data.
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377