From 437eabeaad8fae7547db95c4ca3a0763ad18d38a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Blanchon?= Date: Tue, 8 Mar 2016 22:13:10 +0100 Subject: [PATCH] Speed and size improvement in Print::printFloat() Avoid using the overload of print() for signed integer since a negative value is not allowed here. This results in a smaller (unless print(int) is used somewhere else in the program) and faster code because the overload for unsigned integer is simpler. --- cores/arduino/Print.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp index 5a092af..d829904 100644 --- a/cores/arduino/Print.cpp +++ b/cores/arduino/Print.cpp @@ -257,7 +257,7 @@ size_t Print::printFloat(double number, uint8_t digits) while (digits-- > 0) { remainder *= 10.0; - int toPrint = int(remainder); + unsigned toPrint = unsigned(remainder); n += print(toPrint); remainder -= toPrint; }