7#include "native_simd_utility.hpp"
8#include "../utility/utility.hpp"
9#include "../macros.hpp"
16namespace hi {
inline namespace v1 {
37struct native_simd<
float, 4> {
38 using value_type =
float;
39 constexpr static size_t size = 4;
46 native_simd(native_simd
const&)
noexcept =
default;
75 [[
nodiscard]] native_simd(value_type a, value_type b, value_type c = value_type{0}, value_type d = value_type{0})
noexcept :
82 void store(value_type *out)
const noexcept
84 hi_axiom_not_null(out);
90 void store(
void *out)
const noexcept
92 hi_axiom_not_null(out);
96 [[
nodiscard]]
explicit native_simd(std::span<value_type const>
other)
noexcept
98 hi_axiom(
other.size() >= size);
102 void store(std::span<value_type> out)
const noexcept
104 hi_axiom(out.size() >= size);
112 auto r = array_type{};
160 hi_axiom(a <= 0b1111);
188 return native_simd{
ones};
205 [[
nodiscard]]
friend bool equal(native_simd a, native_simd b)
noexcept
210 return static_cast<array_type
>(a) ==
static_cast<array_type
>(b);
224 return almost_eq(a, b, epsilon).mask() == 0b1111;
227 [[
nodiscard]]
friend native_simd operator==(native_simd a, native_simd b)
noexcept
237 [[
nodiscard]]
friend native_simd operator<(native_simd a, native_simd b)
noexcept
257 [[
nodiscard]]
friend native_simd operator+(native_simd a)
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)
noexcept
274 return native_simd{} - a;
277 [[
nodiscard]]
friend native_simd operator*(native_simd a, native_simd b)
noexcept
282 [[
nodiscard]]
friend native_simd operator/(native_simd a, native_simd b)
noexcept
287 [[
nodiscard]]
friend native_simd operator&(native_simd a, native_simd b)
noexcept
292 [[
nodiscard]]
friend native_simd operator|(native_simd a, native_simd b)
noexcept
297 [[
nodiscard]]
friend native_simd operator^(native_simd a, native_simd b)
noexcept
302 [[
nodiscard]]
friend native_simd operator~(native_simd a)
noexcept
307 [[
nodiscard]]
friend native_simd
min(native_simd a, native_simd b)
noexcept
312 [[
nodiscard]]
friend native_simd
max(native_simd a, native_simd b)
noexcept
317 [[
nodiscard]]
friend native_simd abs(native_simd a)
noexcept
330 [[
nodiscard]]
friend native_simd
ceil(native_simd a)
noexcept
337 template<native_rounding_mode Rounding = native_rounding_mode::current>
346 [[
nodiscard]]
friend native_simd
rcp(native_simd a)
noexcept
353 [[
nodiscard]]
friend native_simd
sqrt(native_simd a)
noexcept
375 template<
size_t Mask>
378 static_assert(
Mask <= 0b1111);
379 if constexpr (
Mask == 0b0000) {
381 }
else if constexpr (
Mask == 0b1111) {
400 template<
size_t Index>
401 [[
nodiscard]]
friend native_simd insert(native_simd a, value_type b)
noexcept
403 static_assert(
Index < 4);
413 template<
size_t SrcIndex,
size_t DstIndex>
414 [[
nodiscard]]
friend native_simd insert(native_simd a, native_simd b)
noexcept
431 template<
size_t Index>
432 [[
nodiscard]]
friend value_type get(native_simd a)
noexcept
434 static_assert(
Index < size);
448 template<
size_t Mask>
449 [[
nodiscard]]
friend native_simd
blend(native_simd a, native_simd b)
noexcept
451 static_assert(
Mask <= 0b1111);
453 if constexpr (
Mask == 0b0000) {
455 }
else if constexpr (
Mask == 0b1111) {
462 return not_and(mask, a) | (mask & b);
479 template<fixed_
string SourceElements>
483 constexpr auto order = detail::native_swizzle_to_packed_indices<SourceElements, size>();
485 if constexpr (
order == 0b11'10'01'00) {
487 }
else if constexpr (
order == 0b00'00'00'00) {
516 template<fixed_
string SourceElements>
520 constexpr auto one_mask = detail::native_swizzle_to_mask<SourceElements, size, '1'>();
521 constexpr auto zero_mask = detail::native_swizzle_to_mask<SourceElements, size, '0'>();
602 template<
size_t SourceMask>
636 [[
nodiscard]]
friend native_simd
not_and(native_simd a, native_simd b)
noexcept
652 template<fixed_
string SourceElements>
655 constexpr auto one_mask = detail::native_swizzle_to_mask<SourceElements, size, '1'>();
656 constexpr auto zero_mask = detail::native_swizzle_to_mask<SourceElements, size, '0'>();
668 to_bool(
one_mask & 0b0001) ? 1.0f : 0.0f,
669 to_bool(
one_mask & 0b0010) ? 1.0f : 0.0f,
670 to_bool(
one_mask & 0b0100) ? 1.0f : 0.0f,
671 to_bool(
one_mask & 0b1000) ? 1.0f : 0.0f};
@ round
The end cap of the line is round.
@ 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