Trouble with Bitwise

Revision en2, by Quake, 2015-09-13 17:17:45

Hey guys, I was looking at solution to the problem BITS: http://mirror.codeforces.com/contest/484/problem/A . I found a line of code i couldn't understand: for(ll i = x ; i <= y ; i += ( ~ i& — ~ i)) ans = i;

what does ( ~ i & — ~ i ) do ?

Thank You

Tags bitmasks, bitwise operators

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Quake 2015-09-13 17:18:43 18
en2 English Quake 2015-09-13 17:17:45 69
en1 English Quake 2015-09-13 17:15:24 308 Initial revision (published)