diff --git a/uart.hpp b/uart.hpp index 68c2d8b..e5adff3 100644 --- a/uart.hpp +++ b/uart.hpp @@ -123,9 +123,6 @@ class Uart { constexpr char alphaChar = (LowerCase) ? 'a' : 'A'; constexpr size_t numDigits = detail::maxNumDigits(); - 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);