Skip to content

Conversation

@Alejandro-Casanova
Copy link

For the following code:

 Log.info("TEST"NL);
 Log.info("%X"NL, 0xE);
 Log.info("%X"NL, 0xF);
 Log.info("%X"NL, 0x10);
 Log.info("%X"NL, 0xFE);
 Log.info("%X"NL, 0xFF);
 Log.info("%X"NL, 0x100);
 Log.info("%X"NL, 0xFFE);
 Log.info("%X"NL, 0xFFF);
 Log.info("%X"NL, 0x1000);

The following output was received, which seems inconsistent (misses one trailing zero for edge cases) and adds too many leading zeros for small numbers.

TEST
0x000E
0x00F
0x0010
0x00FE
0x0FF
0x0100
0x0FFE
0xFFF
0x1000

After this change, this is the result:

TEST
0x0E
0x0F
0x10
0xFE
0xFF
0x0100
0x0FFE
0x0FFF
0x1000

Which correctly handles the edge cases and adds trailing zeros only to complete full bytes, which seems IMHO would be the desired behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant