cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
What these codes supposed to do?
What these codes supposed to do?
Apr 13, 2012 at 8:53am UTC
Baso
(47)
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;
Apr 13, 2012 at 8:56am UTC
Gaminic
(1621)
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.