diff options
author | 2019-02-22 11:09:58 -0300 | |
---|---|---|
committer | 2019-02-22 11:09:58 -0300 | |
commit | 3972e74ee9e4095b6b151894e77e6bdfb449626c (patch) | |
tree | 993529a9c291501ed4d2c4733424c8b5c6373370 /src/lib/netlist/plib/parray.h | |
parent | b58f948528ffc9899b71481e813f04a3049ea1bf (diff) | |
parent | 9ec1ab5d1aa23610e7cff20fad5f05cfbe1aa052 (diff) |
Merge branch 'master' of https://github.com/Robbbert/hbmame
Diffstat (limited to 'src/lib/netlist/plib/parray.h')
-rw-r--r-- | src/lib/netlist/plib/parray.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/netlist/plib/parray.h b/src/lib/netlist/plib/parray.h index 662c2e9550e..e09639163f0 100644 --- a/src/lib/netlist/plib/parray.h +++ b/src/lib/netlist/plib/parray.h @@ -10,6 +10,7 @@ #include "pconfig.h" #include "pexception.h" +#include "palloc.h" #include <array> #include <memory> @@ -30,7 +31,7 @@ namespace plib { struct sizeabs<FT, 0> { static constexpr const std::size_t ABS = 0; - using container = typename std::vector<FT> ; + using container = typename std::vector<FT, aligned_allocator<FT, PALIGN_VECTOROPT>>; }; /** @@ -102,11 +103,17 @@ namespace plib { return m_a[i]; } #else - reference operator[](size_type i) noexcept { return m_a[i]; } - constexpr const_reference operator[](size_type i) const noexcept { return m_a[i]; } + reference operator[](size_type i) noexcept + { + return assume_aligned_ptr<FT, PALIGN_VECTOROPT>(&m_a[0])[i]; + } + constexpr const_reference operator[](size_type i) const noexcept + { + return assume_aligned_ptr<FT, PALIGN_VECTOROPT>(&m_a[0])[i]; + } #endif - FT * data() noexcept { return m_a.data(); } - const FT * data() const noexcept { return m_a.data(); } + FT * data() noexcept { return assume_aligned_ptr<FT, PALIGN_VECTOROPT>(m_a.data()); } + const FT * data() const noexcept { return assume_aligned_ptr<FT, PALIGN_VECTOROPT>(m_a.data()); } private: PALIGNAS_VECTOROPT() |