1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-07 04:13:47 +01:00

handle >999

This commit is contained in:
J. Nick Koston
2025-10-03 00:33:03 +02:00
parent ed907f842d
commit abcbdece2e

View File

@@ -356,12 +356,11 @@ class Logger : public Component {
copy_string(buffer, pos, tag); copy_string(buffer, pos, tag);
buffer[pos++] = ':'; buffer[pos++] = ':';
// Format line number without modulo operations (passed by value, safe to mutate) // Format line number without modulo operations (passed by value, safe to mutate)
if [[unlikely]] if (line > 999) [[unlikely]] {
(line > 999) { int thousands = line / 1000;
int thousands = line / 1000; buffer[pos++] = '0' + thousands;
buffer[pos++] = '0' + thousands; line -= thousands * 1000;
line -= thousands * 1000; }
}
int hundreds = line / 100; int hundreds = line / 100;
int remainder = line - hundreds * 100; int remainder = line - hundreds * 100;
int tens = remainder / 10; int tens = remainder / 10;