We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 84f1628 commit b7f2796Copy full SHA for b7f2796
hardware/arduino/sam/cores/arduino/Print.cpp
@@ -192,7 +192,8 @@ size_t Print::println(const Printable& x)
192
193
// Private Methods /////////////////////////////////////////////////////////////
194
195
-size_t Print::printNumber(unsigned long n, uint8_t base) {
+size_t Print::printNumber(unsigned long n, uint8_t base)
196
+{
197
char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte.
198
char *str = &buf[sizeof(buf) - 1];
199
@@ -202,9 +203,9 @@ size_t Print::printNumber(unsigned long n, uint8_t base) {
202
203
if (base < 2) base = 10;
204
205
do {
- unsigned long m = n;
206
+ char c = n % base;
207
n /= base;
- char c = m - base * n;
208
+
209
*--str = c < 10 ? c + '0' : c + 'A' - 10;
210
} while(n);
211
0 commit comments