What is the difference between:
int main()
{
uint8_t data = 32;
uint16_t calc;
calc = (~data) + 12;
std::cout<< calc;
}
Output: 65515
and
int main()
{
uint8_t data = 32;
uint16_t calc;
data = ~data;
calc = data + 12;
std::cout<< calc;
}
Output: 235
I understand that “~” performs the 1’s complement of data but why is the result of calc different?