Skip to content

Latest commit

 

History

History
16 lines (9 loc) · 447 Bytes

4.25.md

File metadata and controls

16 lines (9 loc) · 447 Bytes

~'q' << 6 is the same as (~'q') << 6.

  1. The operand of ~ operator is a "small integer"(char here), thus its value is first promoted to a larger integral type(int here).

    'q' = 01110001 promoted to 00000000 00000000 00000000 01110001

  2. After the ~ operator evaluated,

    ~'q' 11111111 11111111 11111111 10001110

  3. Left shift,

    ~'q' << 6 11111111 11111111 11100011 10000000

  4. The result is -7296.