HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
sfloat_rg32.hpp
1// Copyright Take Vos 2020.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "../numeric_array.hpp"
8#include <immintrin.h>
9#include <emmintrin.h>
10#include <algorithm>
11
12namespace tt {
13
15 alignas(sizeof(float) * 2)
16 // Red, Green in binary32 (native endian).
18
19public:
20 sfloat_rg32() = default;
21 sfloat_rg32(sfloat_rg32 const &rhs) noexcept = default;
22 sfloat_rg32(sfloat_rg32 &&rhs) noexcept = default;
23 sfloat_rg32 &operator=(sfloat_rg32 const &rhs) noexcept = default;
24 sfloat_rg32 &operator=(sfloat_rg32 &&rhs) noexcept = default;
25
26 sfloat_rg32(f32x4 const &rhs) noexcept :
27 v(static_cast<decltype(v)>(rhs)) {}
28
29 sfloat_rg32 &operator=(f32x4 const &rhs) noexcept {
30 v = static_cast<decltype(v)>(rhs);
31 return *this;
32 }
33
34 operator f32x4 () const noexcept {
35 return f32x4{v};
36 }
37
38 [[nodiscard]] friend bool operator==(sfloat_rg32 const &lhs, sfloat_rg32 const &rhs) noexcept {
39 return lhs.v == rhs.v;
40 }
41 [[nodiscard]] friend bool operator!=(sfloat_rg32 const &lhs, sfloat_rg32 const &rhs) noexcept {
42 return !(lhs == rhs);
43 }
44};
45
46}
Definition sfloat_rg32.hpp:14