16#ifndef RANS_INTERNAL_CONTAINERS_ALIGNEDARRAY_H_
17#define RANS_INTERNAL_CONTAINERS_ALIGNEDARRAY_H_
24#include <fmt/format.h>
33template <
typename array_T>
38 using type = std::conditional_t<std::is_const_v<T>,
const typename T::value_type,
typename T::value_type>;
43 using value_type = gsl::span<typename getValueType<array_T>::type, array_T::nElementsPerLane()>;
110 return this->mIter -
other.mIter;
131template <
typename T, SIMDW
idth w
idth_V,
size_t size_V = 1>
143 static inline constexpr size_t size() noexcept {
return size_V; };
144 static inline constexpr size_t nElementsPerLane() noexcept {
return getElementCount<value_type>(width_V); };
149 template <
typename elem_T, std::enable_if_t<std::is_convertible_v<elem_T, value_type>,
bool> = true>
152 for (
auto& elem : mData) {
160 inline constexpr const T*
data() const noexcept {
return mData; };
161 inline constexpr T*
data() noexcept {
return const_cast<T*
>(
static_cast<const AlignedArray&
>(*this).
data()); };
177 return (*
this)[
idx][elem];
193template <SIMDW
idth w
idth_V,
size_t size_V = 1>
195template <SIMDW
idth w
idth_V,
size_t size_V = 1>
197template <SIMDW
idth w
idth_V,
size_t size_V = 1>
199template <SIMDW
idth w
idth_V,
size_t size_V = 1>
201template <SIMDW
idth w
idth_V,
size_t size_V = 1>
207template <
typename T, SIMDW
idth simd_V>
217template <
typename T, SIMDW
idth simd_V,
size_t size_V>
224namespace alignedArrayImpl
229 template <
typename T, std::enable_if_t<std::is_arithmetic_v<T>,
bool> = true>
232 return fmt::format(
"{}",
value);
237 return fmt::format(
"{}",
static_cast<uint32_t
>(
value));
244 template <
typename T, std::enable_if_t<std::is_arithmetic_v<T>,
bool> = true>
247 return fmt::format(
"{:#0x}",
value);
253template <
typename T, SIMDW
idth w
idth_V,
size_t size_V,
class formater_T = alignedArrayImpl::IdentityFormatingFunctor>
257 for (
auto subspan :
array) {
258 operator<< <const T, getElementCount<T>(width_V), formater_T>(
stream, subspan);
265template <
typename T, SIMDW
idth w
idth_V,
size_t size_V>
268 std::ostringstream
stream;
269 operator<< <T, width_V, size_V, alignedArrayImpl::HexFormatingFunctor>(
stream,
array);
277template <
typename T,
size_t extent_V,
class formatingFunctor = o2::rans::
internal::simd::alignedArrayImpl::IdentityFormatingFunctor>
285 formatingFunctor formater;
288 for (
size_t i = 0;
i < span.size() - 1; ++
i) {
289 stream << formater(span[
i]) <<
", ";
291 stream << formater(*(--span.end())) <<
"]";
300template <
typename T, o2::rans::
internal::simd::SIMDW
idth w
idth_V,
size_t size_V>
303 return gsl::span<const T, o2::rans::internal::simd::AlignedArray<T, width_V, size_V>::nElements()>(
array.data(),
array.nElements());
306template <
typename T, o2::rans::
internal::simd::SIMDW
idth w
idth_V,
size_t size_V>
309 return gsl::span<T, o2::rans::internal::simd::AlignedArray<T, width_V, size_V>::nElements()>(
array.data(),
array.nElements());
common helper classes and functions
constexpr difference_type operator-(const AlignedArrayIterator &other) const noexcept
~AlignedArrayIterator() noexcept=default
constexpr AlignedArrayIterator(AlignedArrayIterator &&iter) noexcept=default
gsl::span< typename getValueType< array_T >::type, array_T::nElementsPerLane()> value_type
constexpr bool operator==(const AlignedArrayIterator &other) const noexcept
constexpr AlignedArrayIterator & operator=(AlignedArrayIterator &&other) noexcept=default
constexpr bool operator>=(const AlignedArrayIterator &other) const noexcept
std::random_access_iterator_tag iterator_category
constexpr AlignedArrayIterator operator+(difference_type i) const noexcept
std::ptrdiff_t difference_type
constexpr AlignedArrayIterator operator-(difference_type i) const noexcept
constexpr bool operator<=(const AlignedArrayIterator &other) const noexcept
constexpr value_type operator[](difference_type i) const noexcept
constexpr bool operator<(const AlignedArrayIterator &other) const noexcept
constexpr AlignedArrayIterator & operator-=(difference_type i) noexcept
constexpr AlignedArrayIterator operator++(int) noexcept
constexpr AlignedArrayIterator() noexcept=default
constexpr AlignedArrayIterator & operator+=(difference_type i) noexcept
constexpr AlignedArrayIterator operator--(int) noexcept
constexpr AlignedArrayIterator & operator--() noexcept
constexpr value_type operator*() const noexcept
constexpr AlignedArrayIterator & operator=(const AlignedArrayIterator &other) noexcept=default
constexpr AlignedArrayIterator(const AlignedArrayIterator &iter) noexcept=default
constexpr bool operator>(const AlignedArrayIterator &other) const noexcept
constexpr bool operator!=(const AlignedArrayIterator &other) const noexcept
static constexpr size_t size() noexcept
std::reverse_iterator< iterator > reverse_iterator
constexpr AlignedArray(Args... args) noexcept
constexpr const_iterator end() const noexcept
constexpr gsl::span< T, nElementsPerLane()> operator[](size_t idx)
static constexpr size_t nElements() noexcept
constexpr const_reverse_iterator rbegin() const noexcept
constexpr const T & operator()(size_t idx) const
constexpr iterator end() noexcept
constexpr const_iterator begin() const noexcept
constexpr T * data() noexcept
std::reverse_iterator< const_iterator > const_reverse_iterator
static constexpr size_t nElementsPerLane() noexcept
constexpr const T & operator()(size_t idx, size_t elem) const
constexpr const T * data() const noexcept
constexpr T & operator()(size_t idx)
constexpr iterator begin() noexcept
constexpr reverse_iterator rbegin() noexcept
constexpr const_reverse_iterator rend() const noexcept
constexpr T & operator()(size_t idx, size_t elem)
constexpr AlignedArray(elem_T value) noexcept
constexpr gsl::span< const T, nElementsPerLane()> operator[](size_t idx) const
constexpr reverse_iterator rend() noexcept
constexpr AlignedArray() noexcept
GLsizei const GLfloat * value
GLint GLint GLsizei GLint GLenum GLenum type
auto make_span(const o2::rans::internal::simd::AlignedArray< T, width_V, size_V > &array)
constexpr size_t elementCount_v
std::string asHex(const AlignedArray< T, width_V, size_V > &array)
constexpr SIMDWidth simdWidth_v
std::ostream & operator<<(std::ostream &stream, const AlignedArray< T, width_V, size_V > &array)
if constexpr(std::is_unsigned_v< source_T >)
Defining DataPointCompositeObject explicitly as copiable.
std::ostream & operator<<(std::ostream &stream, const gsl::span< T, extent_V > &span)
basic SIMD datatypes and traits
VectorOfTObjectPtrs other