What these codes supposed to do?

Hello everybody
I was reading some source code for Sudoku solver and I found these codes, but I don't know what are they do, don't know how they work.
So could any one explain them to me.
Thanks.

1-
x |= 1<<val;

2-
1
2
while ((x & 1<<d) > 0)                   
      ++d;


3-
1
2
for (; x; ++count, x &= (x - 1));
return count;
Those are bitwise operators, more specifically:
1: bitwise OR (and assignment).
2: bitshift-left.
3: bitwise AND (and assignment).

For more information, see the bottom of this page:
http://www.cplusplus.com/doc/tutorial/operators/
Topic archived. No new replies allowed.