Make simd_floats use std::array for storage

This commit is contained in:
Jack Andersen 2019-07-20 22:42:27 -10:00
parent 48073c783b
commit c5d90a5d5e
2 changed files with 10 additions and 7 deletions

View File

@ -315,8 +315,10 @@ constexpr CVector4f& CVector4f::operator=(const CColor& other) {
constexpr CColor skRed(1.f, 0.f, 0.f, 1.f);
constexpr CColor skBlack(0.f, 0.f, 0.f, 1.f);
constexpr CColor skBlue(0.f, 0.f, 1.f, 1.f);
constexpr CColor skCyan(0.f, 1.f, 1.f, 1.f);
constexpr CColor skGreen(0.f, 1.f, 0.f, 1.f);
constexpr CColor skGrey(0.5f, 0.5f, 0.5f, 1.f);
constexpr CColor skMagenta(1.f, 0.f, 1.f, 1.f);
constexpr CColor skOrange(1.f, 0.43f, 0.f, 1.f);
constexpr CColor skPurple(0.63f, 0.f, 1.f, 1.f);
constexpr CColor skYellow(1.f, 1.f, 0.f, 1.f);

View File

@ -1175,15 +1175,16 @@ public:
simd_data(Ts... args) : __data_{args...} {}
value_type operator[](size_t idx) const noexcept { return __data_[idx]; }
value_type& operator[](size_t idx) noexcept { return __data_[idx]; }
const value_type* data() const noexcept { return __data_; }
value_type* data() noexcept { return __data_; }
auto begin() { return std::begin(__data_); }
auto end() { return std::end(__data_); }
auto begin() const { return std::begin(__data_); }
auto end() const { return std::end(__data_); }
const value_type* data() const noexcept { return __data_.data(); }
value_type* data() noexcept { return __data_.data(); }
auto begin() { return __data_.begin(); }
auto end() { return __data_.end(); }
auto begin() const { return __data_.begin(); }
auto end() const { return __data_.end(); }
const std::array<value_type, _Simd::size()>& array() const { return __data_; }
private:
value_type __data_[_Simd::size()];
std::array<value_type, _Simd::size()> __data_;
};
// [simd.class]