Skip to content

Commit

Permalink
switch to ConstantTypeTrait
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad1991 committed Jun 3, 2024
1 parent 65f664e commit 884ed52
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions include/etr_bits/Allocation/Colon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ inline auto colonInternalDerivs(AV &av, T start, T end) {
if (start < end) {
std::size_t length = convertSize(end - start + 1);
av.varConstants[Idx].resize(convertSize(length));
Vec<T, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<T, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
std::size_t counter = 0;
while (start <= end) {
av.varConstants[Idx][counter] = start;
Expand All @@ -262,7 +262,7 @@ inline auto colonInternalDerivs(AV &av, T start, T end) {
}
std::size_t length = convertSize(start - end + 1);
av.varConstants[Idx].resize(convertSize(length));
Vec<T, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<T, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
std::size_t counter = 0;
while (end <= start) {
av.varConstants[Idx][counter] = start;
Expand Down
48 changes: 24 additions & 24 deletions include/etr_bits/Allocation/Vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,21 @@ inline auto vector_integer(AV &av, const T &inp) {
using VecType = int;
if constexpr (std::is_same_v<T, std::size_t>) {
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (std::is_floating_point_v<T>) {
av.varConstants[Idx].resize(convertSize(inp));
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (std::is_integral_v<T>) {
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (IsVecRorCalc<T> || IsVec<T>) {
ass(inp.size() == 1, "invalid length argument");
av.varConstants[Idx].resize(convertSize(inp[0]));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else {
static_assert(sizeof(T) == 0, "Unsupported type in vector");
Expand All @@ -130,21 +130,21 @@ inline auto vector_integer(AV &av, T &inp) {
using VecType = int;
if constexpr (std::is_same_v<T, std::size_t>) {
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (std::is_floating_point_v<T>) {
av.varConstants[Idx].resize(convertSize(inp));
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (std::is_integral_v<T>) {
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (IsVecRorCalc<T> || IsVec<T>) {
ass(inp.size() == 1, "invalid length argument");
av.varConstants[Idx].resize(convertSize(inp[0]));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else {
static_assert(sizeof(T) == 0, "Unsupported type in vector");
Expand All @@ -156,21 +156,21 @@ inline auto vector_logical(AV &av, const T &inp) {
using VecType = bool;
if constexpr (std::is_same_v<T, std::size_t>) {
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (std::is_floating_point_v<T>) {
av.varConstants[Idx].resize(convertSize(inp));
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (std::is_integral_v<T>) {
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (IsVecRorCalc<T> || IsVec<T>) {
ass(inp.size() == 1, "invalid length argument");
av.varConstants[Idx].resize(convertSize(inp[0]));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else {
static_assert(sizeof(T) == 0, "Unsupported type in vector");
Expand All @@ -182,21 +182,21 @@ inline auto vector_logical(AV &av, T &inp) {
using VecType = bool;
if constexpr (std::is_same_v<T, std::size_t>) {
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (std::is_floating_point_v<T>) {
av.varConstants[Idx].resize(convertSize(inp));
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (std::is_integral_v<T>) {
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (IsVecRorCalc<T> || IsVec<T>) {
ass(inp.size() == 1, "invalid length argument");
av.varConstants[Idx].resize(convertSize(inp[0]));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else {
static_assert(sizeof(T) == 0, "Unsupported type in vector");
Expand All @@ -208,21 +208,21 @@ inline auto vector_numeric(AV &av, const T &inp) {
using VecType = BaseType;
if constexpr (std::is_same_v<T, std::size_t>) {
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (std::is_floating_point_v<T>) {
av.varConstants[Idx].resize(convertSize(inp));
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (std::is_integral_v<T>) {
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (IsVecRorCalc<T> || IsVec<T>) {
ass(inp.size() == 1, "invalid length argument");
av.varConstants[Idx].resize(convertSize(inp[0]));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else {
static_assert(sizeof(T) == 0, "Unsupported type in vector");
Expand All @@ -234,21 +234,21 @@ inline auto vector_numeric(AV &av, T &inp) {
using VecType = BaseType;
if constexpr (std::is_same_v<T, std::size_t>) {
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (std::is_floating_point_v<T>) {
av.varConstants[Idx].resize(convertSize(inp));
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (std::is_integral_v<T>) {
av.varConstants[Idx].resize(convertSize(inp));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else if constexpr (IsVecRorCalc<T> || IsVec<T>) {
ass(inp.size() == 1, "invalid length argument");
av.varConstants[Idx].resize(convertSize(inp[0]));
Vec<VecType, VarPointer<decltype(av), Idx, -1>, VariableTypeTrait> ret(av);
Vec<VecType, VarPointer<decltype(av), Idx, -1>, ConstantTypeTrait> ret(av);
return ret;
} else {
static_assert(sizeof(T) == 0, "Unsupported type in vector");
Expand Down

0 comments on commit 884ed52

Please sign in to comment.