Skip to content

Commit e017ede

Browse files
committed
Speed up 'available' function by inserting uint16_t cast
See arduino/ArduinoCore-avr#433 for details
1 parent f621b1a commit e017ede

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

avr/libraries/SoftwareSerial/src/SoftwareSerial.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ int SoftwareSerial::available()
469469
if (!isListening())
470470
return 0;
471471

472-
return (_receive_buffer_tail + _SS_MAX_RX_BUFF - _receive_buffer_head) % _SS_MAX_RX_BUFF;
472+
return ((uint16_t)(_receive_buffer_tail + _SS_MAX_RX_BUFF - _receive_buffer_head)) % _SS_MAX_RX_BUFF;
473473
}
474474

475475
size_t SoftwareSerial::write(uint8_t b)

0 commit comments

Comments
 (0)