Skip to content

Commit

Permalink
Speed up 'available' function by inserting uint16_t cast
Browse files Browse the repository at this point in the history
  • Loading branch information
MCUdude authored and lshw committed Mar 9, 2022
1 parent ea6b0e0 commit aa072fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion avr/libraries/SoftwareSerial/src/SoftwareSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ int SoftwareSerial::available()
if (!isListening())
return 0;

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

size_t SoftwareSerial::write(uint8_t b)
Expand Down

0 comments on commit aa072fc

Please sign in to comment.