Skip to content

Commit

Permalink
More refactoring for MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Pencilcaseman committed Aug 2, 2023
1 parent ae1c78a commit 7d7a7a5
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions librapid/include/librapid/math/vectorForward.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@

namespace librapid {
namespace vectorDetail {
template<typename T, uint64_t N>
template<typename T, size_t N>
struct GenericVectorStorage;

template<typename T, uint64_t N>
template<typename T, size_t N>
struct SimdVectorStorage;

template<typename T, uint64_t N>
template<typename T, size_t N>
struct VectorStorageType {
using type = std::conditional_t<(typetraits::TypeInfo<T>::packetWidth > 1),
SimdVectorStorage<T, N>, GenericVectorStorage<T, N>>;
};

template<typename Storage0, typename Storage1>
auto vectorStorageTypeMerger() {
using Scalar0 = typename typetraits::TypeInfo<Storage0>::Scalar;
using Scalar1 = typename typetraits::TypeInfo<Storage1>::Scalar;
static constexpr uint64_t packetWidth0 = typetraits::TypeInfo<Scalar0>::packetWidth;
static constexpr uint64_t packetWidth1 = typetraits::TypeInfo<Scalar1>::packetWidth;
using Scalar0 = typename typetraits::TypeInfo<Storage0>::Scalar;
using Scalar1 = typename typetraits::TypeInfo<Storage1>::Scalar;
static constexpr size_t packetWidth0 = typetraits::TypeInfo<Scalar0>::packetWidth;
static constexpr size_t packetWidth1 = typetraits::TypeInfo<Scalar1>::packetWidth;
if constexpr (packetWidth0 > 1 && packetWidth1 > 1) {
return SimdVectorStorage<typename Storage0::Scalar, Storage0::dims> {};
} else {
return GenericVectorStorage<typename Storage0::Scalar, Storage0::dims> {};
}
}

template<typename T, uint64_t N>
template<typename T, size_t N>
using VectorStorage = typename VectorStorageType<T, N>::type;

template<typename Storage0, typename Storage1>
Expand Down Expand Up @@ -83,13 +83,13 @@ namespace librapid {
return derived().str(format);
}

LIBRAPID_NODISCARD LIBRAPID_ALWAYS_INLINE virtual GetType _get(uint64_t index) const {
LIBRAPID_NODISCARD LIBRAPID_ALWAYS_INLINE virtual GetType _get(size_t index) const {
return derived()._get(index);
}
};
} // namespace vectorDetail

template<typename ScalarType, uint64_t NumDims>
template<typename ScalarType, size_t NumDims>
class Vector;

namespace vectorDetail {
Expand All @@ -99,26 +99,26 @@ namespace librapid {
template<typename Val, typename Op>
struct UnaryVecOp;

template<typename Scalar, uint64_t N, typename LHS, typename RHS, typename Op,
uint64_t... Indices>
template<typename Scalar, size_t N, typename LHS, typename RHS, typename Op,
size_t... Indices>
LIBRAPID_ALWAYS_INLINE void assignImpl(Vector<Scalar, N> &dst,
const BinaryVecOp<LHS, RHS, Op> &src,
std::index_sequence<Indices...>);

template<typename Scalar, uint64_t N, typename Val, typename Op, uint64_t... Indices>
template<typename Scalar, size_t N, typename Val, typename Op, size_t... Indices>
LIBRAPID_ALWAYS_INLINE void assignImpl(Vector<Scalar, N> &dst,
const UnaryVecOp<Val, Op> &src,
std::index_sequence<Indices...>);

template<typename Scalar, uint64_t N, typename LHS, typename RHS, typename Op>
template<typename Scalar, size_t N, typename LHS, typename RHS, typename Op>
LIBRAPID_ALWAYS_INLINE void assign(Vector<Scalar, N> &dst,
const BinaryVecOp<LHS, RHS, Op> &src);

template<typename Scalar, uint64_t N, typename Val, typename Op>
template<typename Scalar, size_t N, typename Val, typename Op>
LIBRAPID_ALWAYS_INLINE void assign(Vector<Scalar, N> &dst, const UnaryVecOp<Val, Op> &src);
} // namespace vectorDetail

template<typename ScalarType, uint64_t NumDims>
template<typename ScalarType, size_t NumDims>
class Vector;
} // namespace librapid

Expand Down

0 comments on commit 7d7a7a5

Please sign in to comment.