8000 fixed printNumber base2 and base16 code for -mint8 · arduino/ArduinoCore-avr@e5c727e · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e5c727e

Browse files
committed
fixed printNumber base2 and base16 code for -mint8
1 parent 66645a2 commit e5c727e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/arduino/Print.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ size_t Print::printNumber(unsigned long n, uint8_t base)
218218
{
219219
uint8_t *access = (uint8_t*) &n;
220220
uint8_t written = 0;
221-
for (int8_t i=3; i>=0; i--) {
221+
for (int8_t i=sizeof(unsigned long)-1; i>=0; i--) {
222222
char c;
223223
c = (access[i] & 0xf0) >> 4;
224224
if (c != 0 || written != 0) {
@@ -238,7 +238,7 @@ size_t Print::printNumber(unsigned long n, uint8_t base)
238238
{
239239
uint8_t *access = (uint8_t*) &n;
240240
uint8_t written = 0;
241-
for (int8_t i=3; i>=0; i--) {
241+
for (int8_t i=sizeof(unsigned long)-1; i>=0; i--) {
242242
if (access[i] == 0 && written == 0) {
243243
// skip leading zeros
244244
continue;

0 commit comments

Comments
 (0)
0