Skip to content

Commit

Permalink
huh? i guess it's just 'modulo'. let's save even more
Browse files Browse the repository at this point in the history
  • Loading branch information
tico-tico committed Feb 29, 2016
1 parent 275a47d commit a7454b6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hardware/arduino/avr/cores/arduino/Print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ size_t Print::println(const Printable& x)

// Private Methods /////////////////////////////////////////////////////////////

size_t Print::printNumber(unsigned long n, uint8_t base) {
size_t Print::printNumber(unsigned long n, uint8_t base)
{
char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte.
char *str = &buf[sizeof(buf) - 1];

Expand All @@ -210,9 +211,9 @@ size_t Print::printNumber(unsigned long n, uint8_t base) {
if (base < 2) base = 10;

do {
unsigned long m = n;
char c = n % base;
n /= base;
char c = m - base * n;

*--str = c < 10 ? c + '0' : c + 'A' - 10;
} while(n);

Expand Down

0 comments on commit a7454b6

Please sign in to comment.