面试题47 不用+-*/ 做加法

int sum(int a, int b){
    int carry = 1;
    int res = 0 ;
    while(carry != 0){
        res = a^b;
        carry = (a&b)<<1;
        a = res;
        b = carry;
    }
    return res;
}
原文地址:https://www.cnblogs.com/graph/p/3331040.html