X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fjtag%2Fswd.h;h=fee7f912a3e37b8aed858541817e89a294348bb8;hp=f131ddbc3ee38cc21b94b4b29573bf6c108f87f2;hb=31138437c38348711a1890f9d39f73f4e5e989d5;hpb=4dc8cd201c667bac72bc083ef1fa1b285eb093fc diff --git a/src/jtag/swd.h b/src/jtag/swd.h index f131ddbc3e..fee7f912a3 100644 --- a/src/jtag/swd.h +++ b/src/jtag/swd.h @@ -33,7 +33,7 @@ /* followed by TRN, 3-bits of ACK, TRN */ /* pbit16 holds precomputed parity bits for each nibble */ -#define pbit(parity, nibble) (parity << nibble) +#define pbit(parity, nibble) ((parity) << (nibble)) static const uint16_t pbit16 = pbit(0, 0) | pbit(1, 1) | pbit(1, 2) | pbit(0, 3) @@ -41,7 +41,7 @@ static const uint16_t pbit16 = | pbit(1, 8) | pbit(0, 9) | pbit(0, 0xa) | pbit(1, 0xb) | pbit(0, 0xc) | pbit(1, 0xd) | pbit(1, 0xe) | pbit(0, 0xf); -#define nibble_parity(nibble) (pbit16 & pbit(1, nibble)) +#define nibble_parity(nibble) (pbit16 & pbit(1, (nibble))) /** * Construct a "cmd" byte, in lSB bit order, which swd_driver.read_reg()