Removed sign from maxNumDigits, because sign is handled separately anyway

This commit is contained in:
BlackMark 2019-08-07 19:59:48 +02:00
parent 1c026e8eb3
commit 1ee9bc8ca4

View File

@ -36,18 +36,6 @@ static constexpr size_t maxNumDigits()
constexpr T minVal = util::NumericLimits<T>::min();
constexpr T maxVal = util::NumericLimits<T>::max();
T minDigits = cntDigits<T, minVal, Base>() + ((minVal < 0) ? 1 : 0);
T maxDigits = cntDigits<T, maxVal, Base>() + ((maxVal < 0) ? 1 : 0);
return (minDigits < maxDigits) ? maxDigits : minDigits;
}
template <typename T, size_t Base>
static constexpr size_t maxPadding()
{
constexpr T minVal = util::NumericLimits<T>::min();
constexpr T maxVal = util::NumericLimits<T>::max();
T minDigits = cntDigits<T, minVal, Base>();
T maxDigits = cntDigits<T, maxVal, Base>();
@ -125,9 +113,9 @@ class Uart {
static void txNumber(const T &val)
{
static_assert(util::is_integral_v<T>, "Only supported on integral types");
static_assert(Base >= 2, "Numbers with bases less than 2 make no sense");
static_assert(Base <= 16, "Numbers with bases higher than 16 are not supported");
static_assert(Padding <= detail::maxPadding<T, Base>(), "Cannot pad more than maximum length of number");
static_assert(Base >= 2, "Numbers with base less than 2 make no sense");
static_assert(Base <= 16, "Numbers with base higher than 16 are not supported");
static_assert(Padding <= detail::maxNumDigits<T, Base>(), "Cannot pad more than maximum length of number");
constexpr char alphaChar = (LowerCase) ? 'a' : 'A';
constexpr size_t numDigits = detail::maxNumDigits<T, Base>();