HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
sfloat_rgb32.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 // Red, Green, Blue in binary32 (native endian).
17
18public:
19 sfloat_rgb32() = default;
20 sfloat_rgb32(sfloat_rgb32 const &rhs) noexcept = default;
21 sfloat_rgb32(sfloat_rgb32 &&rhs) noexcept = default;
22 sfloat_rgb32 &operator=(sfloat_rgb32 const &rhs) noexcept = default;
23 sfloat_rgb32 &operator=(sfloat_rgb32 &&rhs) noexcept = default;
24
25 sfloat_rgb32(f32x4 const &rhs) noexcept : v(static_cast<std::array<float,3>>(rhs)) {}
26
27 sfloat_rgb32 &operator=(f32x4 const &rhs) noexcept {
28 v = static_cast<std::array<float, 3>>(rhs);
29 return *this;
30 }
31
32 operator f32x4 () const noexcept {
33 return f32x4{v};
34 }
35
36 [[nodiscard]] friend bool operator==(sfloat_rgb32 const &lhs, sfloat_rgb32 const &rhs) noexcept {
37 return lhs.v == rhs.v;
38 }
39 [[nodiscard]] friend bool operator!=(sfloat_rgb32 const &lhs, sfloat_rgb32 const &rhs) noexcept {
40 return !(lhs == rhs);
41 }
42};
43
44}
Definition sfloat_rgb32.hpp:14