#include <iostream>
using namespace std;

int main()
{
    // 本质是找二进制运算规律的数学题:求x中1的个数
    // 999 = 0x03E7
    // 即11 11110111
    int i = 0;
    int x = 999;
    while(x)
    {
        i++;
        x = x & (x - 1);
    }

    cout << "i=" << i << endl;
    return 0;
}



本文链接地址: x = x & (x - 1)的作用
https://blog.qingfengju.com/index.asp?id=413

分类:Win32/C++ 查看次数:4390 发布时间:2015/5/9 11:49:50

这两个插件都是代码编辑器的缩进线(Indent Guide)功能,效果就像Notepad2这样(View -> Indentation Guides Ctrl+Shift+G):

Visual Studio:
http://indentguide.codeplex.com/

Eclipse:
http://sschaef.github.io/IndentGuide/
安装方法参见:http://stackoverflow.com/questions/17961050/eclipse-indent-guide (Michal Graffy的答案)
 


本文链接地址: 两大IDE的IndentGuide/缩进线插件
https://blog.qingfengju.com/index.asp?id=386

分类:杂谈随感 查看次数:10445 发布时间:2015/3/25 17:21:32