Skip to content

Commit a81294f

Browse files
committed
avoid writing to base variable so the compiler has a chance of better optimization due to it being basically const then
1 parent e5c727e commit a81294f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/arduino/Print.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ size_t Print::printNumber(unsigned long n, uint8_t base)
208208
}
209209

210210
// prevent crash if called with base == 1
211-
if (base < 2) base = 10;
211+
if (base < 2) return printNumber(n, 10);
212212

213213
// use -D ARDUINO_PRINT_NUMBER_GENERIC_ONLY when compiling to get only the generic version
214214
#ifndef ARDUINO_PRINT_NUMBER_GENERIC_ONLY

0 commit comments

Comments
 (0)