From 54f577a9702ea5b2f60b68a403ddaf8049a34dab Mon Sep 17 00:00:00 2001 From: dragonmux Date: Fri, 21 Jan 2022 21:31:59 -0500 Subject: [PATCH] hosted/dap: Partial revert of 5c8e277, taking into account that division may not be available on platforms 'hosted' might see itself built --- src/platforms/hosted/dap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/platforms/hosted/dap.c b/src/platforms/hosted/dap.c index 39318b3..3adc424 100644 --- a/src/platforms/hosted/dap.c +++ b/src/platforms/hosted/dap.c @@ -721,9 +721,9 @@ void dap_jtagtap_tdi_tdo_seq(uint8_t *DO, bool final_tms, const uint8_t *TMS, *p++ = transfers; for (int i = 0; i < transfers; i++) { *p++ = 1 | ((DO) ? DAP_JTAG_TDO_CAPTURE : 0) | - ((TMS[i / 8] & (1 << (i & 7))) ? DAP_JTAG_TMS : 0); + ((TMS[i >> 3] & (1 << (i & 7))) ? DAP_JTAG_TMS : 0); if (DI) - *p++ = (DI[i / 8] & (1 << (i & 7))) ? 1 : 0; + *p++ = (DI[i >> 3] & (1 << (i & 7))) ? 1 : 0; else *p++ = 1; } @@ -733,9 +733,9 @@ void dap_jtagtap_tdi_tdo_seq(uint8_t *DO, bool final_tms, const uint8_t *TMS, if (DO) { for (int i = 0; i < transfers; i++) { if (buf[i + 1]) - DO[i / 8] |= (1 << (i & 7)); + DO[i >> 3] |= (1 << (i & 7)); else - DO[i / 8] &= ~(1 << (i & 7)); + DO[i >> 3] &= ~(1 << (i & 7)); } } ticks -= transfers;