```
for ( x = y; x > 0; x = ( y & (x-1) ) )
```

how does this loop gives all subset of y.

I can see that it prints all the subsets but how do it intuitively understand/prove that it should print the subsets and that loop will execute 2^n -1 times?

source :

10th point in http://codeforces.com/blog/entry/18169#comment-407423