Skip to content

Commit 9da1069

Browse files
committed
Fix 32bit long used in long long printNumber.
1 parent 6c76c94 commit 9da1069

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cores/arduino/Print.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ size_t Print::println(const Printable& x)
226226

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

232232
*str = '\0';
@@ -246,7 +246,7 @@ size_t Print::printNumber(unsigned long n, uint8_t base)
246246

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

252252
*str = '\0';
@@ -255,7 +255,7 @@ size_t Print::printNumber(unsigned long long n, uint8_t base)
255255
if (base < 2) base = 10;
256256

257257
do {
258-
unsigned long m = n;
258+
auto m = n;
259259
n /= base;
260260
char c = m - base * n;
261261

0 commit comments

Comments
 (0)