aboutsummaryrefslogtreecommitdiff
path: root/libraries/SoftwareSerial
diff options
context:
space:
mode:
authorMartino Facchin <m.facchin@arduino.cc>2021-11-17 11:06:45 +0100
committerGitHub <noreply@github.com>2021-11-17 11:06:45 +0100
commit6507dfef3ed9af8e83acd5f02496b0ac872f3cfd (patch)
treeb6f7a718d674a7a39485b6856062992a335f1a3d /libraries/SoftwareSerial
parent44dc454b9382298fa8be542c8c92e7944d9aa21e (diff)
parent65e63bf378488dabf79e377debd4b0fa05fb3316 (diff)
Merge pull request #433 from felias-fogg/master
Speed up 'available' method by inserting unsigned int cast
Diffstat (limited to 'libraries/SoftwareSerial')
-rw-r--r--libraries/SoftwareSerial/src/SoftwareSerial.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libraries/SoftwareSerial/src/SoftwareSerial.cpp b/libraries/SoftwareSerial/src/SoftwareSerial.cpp
index 3163d7a..5a387ab 100644
--- a/libraries/SoftwareSerial/src/SoftwareSerial.cpp
+++ b/libraries/SoftwareSerial/src/SoftwareSerial.cpp
@@ -409,7 +409,7 @@ int SoftwareSerial::available()
if (!isListening())
return 0;
- return (_receive_buffer_tail + _SS_MAX_RX_BUFF - _receive_buffer_head) % _SS_MAX_RX_BUFF;
+ return ((unsigned int)(_receive_buffer_tail + _SS_MAX_RX_BUFF - _receive_buffer_head)) % _SS_MAX_RX_BUFF;
}
size_t SoftwareSerial::write(uint8_t b)