merged branch 'unbounded-processing' into 'dev'

This commit is contained in:
Alberto Griggio
2018-03-28 21:35:23 +02:00
17 changed files with 516 additions and 317 deletions

View File

@@ -138,6 +138,20 @@ constexpr std::uint8_t uint16ToUint8Rounded(std::uint16_t i)
return ((i + 128) - ((i + 128) >> 8)) >> 8;
}
template <typename T>
constexpr bool OOG(const T &val, const T &high=T(MAXVAL))
{
return (val < T(0)) || (val > high);
}
template <typename T>
void setUnlessOOG(T &out, const T &val)
{
if (!OOG(out)) {
out = val;
}
}
template <typename T>
bool invertMatrix(const std::array<std::array<T, 3>, 3> &in, std::array<std::array<T, 3>, 3> &out)
@@ -165,6 +179,7 @@ bool invertMatrix(const std::array<std::array<T, 3>, 3> &in, std::array<std::arr
return true;
}
template <typename T>
std::array<std::array<T, 3>, 3> dotProduct(const std::array<std::array<T, 3>, 3> &a, const std::array<std::array<T, 3>, 3> &b)
{
@@ -199,6 +214,5 @@ std::array<T, 3> dotProduct(const std::array<std::array<T, 3>, 3> &a, const std:
return res;
}
}