aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/new.cpp
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2014-04-22 22:24:43 +0200
committerMatthijs Kooijman <matthijs@stdin.nl>2015-01-26 17:03:25 +0100
commit157ec9754003497adaad50a74c16d455a68f342e (patch)
tree14306026d696f142168fa7c9409e7ba0fb5d0976 /cores/arduino/new.cpp
parentc69c0b52aa66714a501544175215fd9723532dc2 (diff)
Optimize SoftwareSerial::recv
Similar to SoftwareSerial::write, this rewrites the loop to only touch the MSB and then shift those bits up, allowing the compiler to generate more efficient code. Unlike the write function however, it is not needed to put all instance variables used into local variables, for some reason the compiler already does this (and doing it manually even makes the code bigger). On the Arduino Uno using gcc 4.3 this saves 26 bytes. Using gcc 4.8 this saves 30 bytes. Note that this removes the else clause in the code, making the C code unbalanced, which looks like it breaks timing balance. However, looking at the code generated by the compiler, it turns out that the old code was actually unbalanced, while the new code is properly balanced.
Diffstat (limited to 'cores/arduino/new.cpp')
0 files changed, 0 insertions, 0 deletions