We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 275a47d commit a7454b6Copy full SHA for a7454b6
hardware/arduino/avr/cores/arduino/Print.cpp
@@ -200,7 +200,8 @@ size_t Print::println(const Printable& x)
200
201
// Private Methods /////////////////////////////////////////////////////////////
202
203
-size_t Print::printNumber(unsigned long n, uint8_t base) {
+size_t Print::printNumber(unsigned long n, uint8_t base)
204
+{
205
char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte.
206
char *str = &buf[sizeof(buf) - 1];
207
@@ -210,9 +211,9 @@ size_t Print::printNumber(unsigned long n, uint8_t base) {
210
211
if (base < 2) base = 10;
212
213
do {
- unsigned long m = n;
214
+ char c = n % base;
215
n /= base;
- char c = m - base * n;
216
+
217
*--str = c < 10 ? c + '0' : c + 'A' - 10;
218
} while(n);
219
0 commit comments