Skip to content

Commit ad2f414

Browse files
Fix always-true comparison warning in pio_insn (#2608)
The sideset_bit_count in pio_encode_sideset_opt is unsigned, so any comparison "sideset_bit_count >= 0" will always be true. GCC with pedantic warnings will complain when this happens. Remove the unneeded >=0 portion of the parameter validity check. Fixes #2607
1 parent 4e1371f commit ad2f414

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/rp2_common/hardware_pio/include/hardware/pio_instructions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static inline uint pio_encode_sideset(uint sideset_bit_count, uint value) {
148148
* \return the side set bits to be ORed with an instruction encoding
149149
*/
150150
static inline uint pio_encode_sideset_opt(uint sideset_bit_count, uint value) {
151-
valid_params_if(PIO_INSTRUCTIONS, sideset_bit_count >= 0 && sideset_bit_count <= 4);
151+
valid_params_if(PIO_INSTRUCTIONS, sideset_bit_count <= 4);
152152
valid_params_if(PIO_INSTRUCTIONS, value <= ((1u << sideset_bit_count) - 1));
153153
return 0x1000u | value << (12u - sideset_bit_count);
154154
}

0 commit comments

Comments
 (0)