From 437eabeaad8fae7547db95c4ca3a0763ad18d38a Mon Sep 17 00:00:00 2001 From: BenoƮt Blanchon Date: Tue, 8 Mar 2016 22:13:10 +0100 Subject: 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(-) (limited to 'cores/arduino/Print.cpp') 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; } -- cgit v1.2.3-18-g5258