Large integer implicitly truncated to unsigned type [-Woverflow] warning in bit mask

55 views Asked by At

While creating a bit mask to set a bit in 8-bit register, I encounter this warning, but I can't see what can be wrong here:

static const uint8_t sck_pin_n_mask = ~(1 << SCK_LCD_PIN);

SCK_LCD_PIN equals 7.

If I try to change the type to int8_t the warning changes to: Overflow in implicit constant conversion

Am I missing something, and what should I do?

0

There are 0 answers