Open
Description
From @svatoun on December 13, 2016 8:34
let's have a bitWrite(data, bitIndex, computedValue == 5 ? 1: 0);
bitWrite macro definition lacks parenthesis around the `bitvalue' parameter, so it expands as follows
(computedValue == 5 ? 1 : 0 ? bitSet(value, bit) : bitClear(value, bit))
and the `0 ? bitSet...' is then compiled as the false branch of the ternary operator in the passed expression.
Please correct the definition as follows:
#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit))
(parenthesis added)
Copied from original issue: arduino/Arduino#5714