From 0a52110d479a539e520cd63faedb6cbae153f83e Mon Sep 17 00:00:00 2001 From: BlackMark Date: Sun, 5 Apr 2020 03:28:45 +0200 Subject: [PATCH] Moved buffer closer to where needed --- uart.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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);