Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid equality expressions in twi_pins.c #1169

Open
jvasileff opened this issue Nov 16, 2024 · 0 comments
Open

Invalid equality expressions in twi_pins.c #1169

jvasileff opened this issue Nov 16, 2024 · 0 comments

Comments

@jvasileff
Copy link
Contributor

Compiling with warnings enabled exposed a couple of expressions that will never evaluate to true because 0x01 will never equal 0x00 or 0x10

lib/megaTinyCore/megaavr/libraries/Wire/src/twi_pins.c: In function 'TWI0_usePullups':
lib/megaTinyCore/megaavr/libraries/Wire/src/twi_pins.c:443:16: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
  443 |       if (true == (PORTMUX.CTRLB & PORTMUX_TWI0_bm)) {
      |                ^~
lib/megaTinyCore/megaavr/libraries/Wire/src/twi_pins.c: In function 'TWI0_checkPinLevel':
lib/megaTinyCore/megaavr/libraries/Wire/src/twi_pins.c:494:16: warning: bitwise comparison always evaluates to false [-Wtautological-compare]
  494 |       if (true == (PORTMUX.CTRLB & PORTMUX_TWI0_bm)) {
      |                ^~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant