int add(int a, int b) { int wei = 0; int jinwei = 0; do { wei = a^b;//处理位加法 jinwei = (a&b) << 1; a = wei; b = jinwei; } while (b != 0); return a; }
两个数相加=两个数亦或(相当于不考虑进位之和)+与左移一位(加上进位的和);