It looks as if the unary bitwise not operator (~) on uint16_t and uint8_t returns int, and not the type of its operand (same for unary -). Can someone give a reason why this is so?
It came as a surprise that ~uint16_t(0) < uint16_t(0)
I use g++ version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2) x86_64-linux-gnu