while(y != 0) { int carry = x & y; x = x ^ y; y = carry << 1; } Please explain how this cycle works.
while(y != 0) { int carry = x & y; x = x ^ y; y = carry << 1; } Please explain how this cycle works.
Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .
the string
x = x ^ yinterest
^ - means an exclusive or (XOR) bit operation:
The remarkable thing about XOR is that dual application of XOR restores the primary result, i.e.
X==(X^Y)^Y Source: https://ru.stackoverflow.com/questions/727498/
All Articles