⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex3_04.cpp

📁 一本语言类编程书籍
💻 CPP
字号:
/*********************************************************************************
Exercise 3.4 The output from the code is 2. Here's the important statement again:

  unsigned int j = (k >> 4) & ~(~0 << 3);

This question is an exercise in bit manipulation on k. 
First, (k >> 4) shifts the bits in k 4 places to the right;
 the bitwise representation of 430 is 110101110, 
so a 4-bit shift leaves 11010. 
Next, ~0 is composed of all 1s; shifting that three places to the left
 and complementing the result will leave 111. 
Finally, doing a bitwise AND on 11010 and 111 leaves 10 (in binary)
 or 2 (in decimal) as the result.
*********************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -