摘要: 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溢出Ref[1] http://aggregate.ee.engr.uky.edu/MAGIC/ 阅读全文
posted @ 2011-08-23 13:43 yky 阅读(160) 评论(0) 推荐(0) 编辑