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<int32_t, 4> {
41 using value_type = int32_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 :
85 void store(value_type *out)
const noexcept
87 hi_axiom_not_null(out);
95 void store(
void *out)
const noexcept
97 hi_axiom_not_null(out);
101 [[
nodiscard]]
explicit native_simd(std::span<value_type const>
other)
noexcept
103 hi_axiom(
other.size() >= size);
107 void store(std::span<value_type> out)
const noexcept
109 hi_axiom(out.size() >= size);
120 auto r = array_type{};
169 template<
size_t Mask>
173 to_bool(
Mask & 0b0001) ?
static_cast<value_type
>(0xffff'ffff) : 0,
183 hi_axiom(a <= 0b1111);
197 return native_simd{
tmp};
207 [[
nodiscard]]
friend bool equal(native_simd a, native_simd b)
noexcept
209 return (a == b).mask() == 0b1111;
212 [[
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
242 [[
nodiscard]]
friend native_simd operator+(native_simd a)
noexcept
247 [[
nodiscard]]
friend native_simd operator-(native_simd a)
noexcept
249 return native_simd{} - a;
252 [[
nodiscard]]
friend native_simd operator+(native_simd a, native_simd b)
noexcept
257 [[
nodiscard]]
friend native_simd operator-(native_simd a, native_simd b)
noexcept
262 [[
nodiscard]]
friend native_simd operator*(native_simd a, native_simd b)
noexcept
267 [[
nodiscard]]
friend native_simd operator&(native_simd a, native_simd b)
noexcept
272 [[
nodiscard]]
friend native_simd operator|(native_simd a, native_simd b)
noexcept
277 [[
nodiscard]]
friend native_simd operator^(native_simd a, native_simd b)
noexcept
282 [[
nodiscard]]
friend native_simd operator~(native_simd a)
noexcept
289 [[
nodiscard]]
friend native_simd operator<<(native_simd a,
unsigned int b)
noexcept
291 hi_axiom_bounds(b,
sizeof(value_type) *
CHAR_BIT);
295 [[
nodiscard]]
friend native_simd operator>>(native_simd a,
unsigned int b)
noexcept
297 hi_axiom_bounds(b,
sizeof(value_type) *
CHAR_BIT);
301 [[
nodiscard]]
friend native_simd
min(native_simd a, native_simd b)
noexcept
307 return (mask & a) |
not_and(mask, b);
311 [[
nodiscard]]
friend native_simd
max(native_simd a, native_simd b)
noexcept
317 return (mask & a) |
not_and(mask, b);
321 [[
nodiscard]]
friend native_simd abs(native_simd a)
noexcept
326 hilet mask = a >= native_simd{};
327 return (mask & a) |
not_and(mask, -a);
337 template<
size_t Mask>
340 static_assert(
Mask <= 0b1111);
356 template<
size_t Index>
357 [[
nodiscard]]
friend native_simd insert(native_simd a, value_type b)
noexcept
359 static_assert(
Index < 4);
375 template<
size_t Index>
376 [[
nodiscard]]
friend value_type get(native_simd a)
noexcept
381 auto r =
static_cast<array_type
>(a);
382 return std::get<Index>(r);
394 template<
size_t Mask>
395 [[
nodiscard]]
friend native_simd
blend(native_simd a, native_simd b)
noexcept
401 return not_and(mask, a) | (mask & b);
417 template<fixed_
string SourceElements>
420 constexpr auto order = detail::native_swizzle_to_packed_indices<SourceElements, size>();
422 if constexpr (
order == 0b11'10'01'00) {
424 }
else if constexpr (
order == 0b00'00'00'00) {
447 template<fixed_
string SourceElements>
450 constexpr auto one_mask = detail::native_swizzle_to_mask<SourceElements, size, '1'>();
451 constexpr auto zero_mask = detail::native_swizzle_to_mask<SourceElements, size, '0'>();
532 template<
size_t SourceMask>
544 [[
nodiscard]]
friend native_simd
not_and(native_simd a, native_simd b)
noexcept
554 template<fixed_
string SourceElements>
557 constexpr auto one_mask = detail::native_swizzle_to_mask<SourceElements, size, '1'>();
558 constexpr auto zero_mask = detail::native_swizzle_to_mask<SourceElements, size, '0'>();
573 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