Moved buffer closer to where needed

This commit is contained in:
BlackMark 2020-04-05 03:28:45 +02:00
parent f751833a88
commit 0a52110d47

View File

@ -123,9 +123,6 @@ class Uart {
constexpr char alphaChar = (LowerCase) ? 'a' : 'A';
constexpr size_t numDigits = detail::maxNumDigits<T, Base>();
data_t buffer[numDigits];
data_t *bufEnd = buffer + numDigits - 1;
T digits = val;
if (digits < 0) {
@ -133,6 +130,9 @@ class Uart {
txByte('-');
}
data_t buffer[numDigits];
data_t *bufEnd = buffer + numDigits - 1;
do {
data_t lastDigit = digits % Base;
*bufEnd-- = (lastDigit < 10) ? ('0' + lastDigit) : (alphaChar + lastDigit - 10);