diff --git a/src/platforms/common/swdptap.c b/src/platforms/common/swdptap.c index 6f51f761c14..458d43bc614 100644 --- a/src/platforms/common/swdptap.c +++ b/src/platforms/common/swdptap.c @@ -199,10 +199,10 @@ static void swdptap_seq_out(const uint32_t tms_states, const size_t clock_cycles static void swdptap_seq_out_parity(const uint32_t tms_states, const size_t clock_cycles) { - const int parity = __builtin_popcount(tms_states); + const uint8_t parity = __builtin_popcount(tms_states) & 1U; swdptap_seq_out(tms_states, clock_cycles); - gpio_set_val(SWDIO_PORT, SWDIO_PIN, parity & 1U); + gpio_set_val(SWDIO_PORT, SWDIO_PIN, parity); if (target_clk_divider != UINT32_MAX) platform_delay_busy(target_clk_divider);