+ 3
It is similar for -1<<4
Arithmetic left shift Âč: shifting `-1` in two's complement ÂČ representation to left by one as
-1 << 1
At binary level (32-bit words) we have:
1 =
0000 0000 0000 0000 0000 0000 0000 0001
-1 =
1111 1111 1111 1111 1111 1111 1111 1111
and by doing
1111 1111 1111 1111 1111 1111 1111 1111 << 1
we get
1111 1111 1111 1111 1111 1111 1111 1110 = -2 in decimal
And "%x" specifier would nicely format the hexadecimal representation of the above bit sequence [converts an unsigned integer into hexadecimal representation hhhh. Âł]. Every 4 bits comprise one hex digit. So the total hex numbers are 8 as
fffffffe or FFFFFFFE (for "%X")
_____
Âč https://en.wikipedia.org/wiki/Arithmetic_shift
ÂČ https://en.wikipedia.org/wiki/Two%27s_complement
Âł https://en.cppreference.com/w/cpp/io/c/fprintf



