From 80ea38b1dc55ffa43521c7e3ad55b79728fdf3cf Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Tue, 22 Apr 2014 17:45:21 +0200 Subject: [PATCH] Mark SoftwareSerial::tx_pin_write as "always_inline" Somehow gcc 4.8 doesn't inline this function, even though it is always called with constant arguments and can be reduced to just a few instructions when inlined. Adding the always_inline attribute makes gcc inline it, saving 46 bytes on the Arduino uno. gcc 4.3 already inlined this function, so there are no space savings there. --- hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.h b/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.h index 27c0bfca9..778fffbf5 100644 --- a/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.h +++ b/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.h @@ -71,7 +71,7 @@ private: // private methods void recv(); uint8_t rx_pin_read(); - void tx_pin_write(uint8_t pin_state); + void tx_pin_write(uint8_t pin_state) __attribute__((__always_inline__)); void setTX(uint8_t transmitPin); void setRX(uint8_t receivePin); void setRxIntMsk(bool enable);