diff options
author | Alexander Entinger <cto@lxrobotics.com> | 2019-09-16 09:58:35 +0200 |
---|---|---|
committer | Alexander Entinger <consulting@lxrobotics.com> | 2019-09-16 10:08:28 +0200 |
commit | becb995388d7cbdd5f9cfbd41b82c7152ef6513f (patch) | |
tree | 0e0899953b74d034ebb825c1c597b7d8525185bb /cores | |
parent | 815d3112a6a00015a8af7f8eddce3b9f560587e6 (diff) |
Adding parenthesis around 'bitvalue' allowing correct macro expansion when using with ternary operator such as bitWrite(value, bit, some_computed_value == 5 ? 1: 0);'
Diffstat (limited to 'cores')
-rw-r--r-- | cores/arduino/Arduino.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 09c1448..d1a46d0 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -111,7 +111,7 @@ void yield(void); #define bitRead(value, bit) (((value) >> (bit)) & 0x01) #define bitSet(value, bit) ((value) |= (1UL << (bit))) #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) -#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) +#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit)) // avr-libc defines _NOP() since 1.6.2 #ifndef _NOP |