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.
This commit is contained in:
Benoît Blanchon 2016-03-08 22:13:10 +01:00
parent aa710ab682
commit 437eabeaad
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}