aboutsummaryrefslogtreecommitdiff
path: root/cores
diff options
context:
space:
mode:
authorBenoît Blanchon <bblanchon@users.noreply.github.com>2016-03-08 22:13:10 +0100
committerBenoît Blanchon <bblanchon@users.noreply.github.com>2016-03-08 22:13:10 +0100
commit437eabeaad8fae7547db95c4ca3a0763ad18d38a (patch)
treee12135011b8c6a5d5dc963c1fff8805d1faf64ae /cores
parentaa710ab682fd73ed8ea166ebbf24d103673c5ca6 (diff)
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.
Diffstat (limited to 'cores')
-rw-r--r--cores/arduino/Print.cpp2
1 files changed, 1 insertions, 1 deletions
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;
}