x+y = (x&y) + (x|y) //在第k位: xk=1,yk=1,则(x&y)k=1,(x|y)k=1; xk=0,yk=1,则(x&y)k=0,(x|y)k=1; 所以做加法不影响结果
(x|y) = (x&y) + (x^y)
x+y = 2*(x&y) + (x^y)
ë(x+y)/2û = (x&y) + (x^y)>>1 //为了防止x+y溢出
[1] http://aggregate.ee.engr.uky.edu/MAGIC/