Closed
Description
Hello.
I've found a trivial bug in bitWrite
macro. It's written as
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
and its argument bitvalue is not enclosed in parentheses. This gives incorrect result for some arguments, for example I've triggered the bug with this code:
bool b=true;
bitWrite(dst, bit, b?1:0);
The macro is here: https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/Arduino.h#L91 and it affects all versions of ESP32 core since it was introduced.
In AVR Arduino core this macro is correct:
https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/Arduino.h#L115
Metadata
Metadata
Assignees
Labels
No labels