Int the add (int a, int b) {
If (b==0) return a;
Int c=a ^ b;
Int d=(a & amp; B) & lt; <1;
Return to the add (c, d);
}
Also know that for the average (a& (b) + (a ^ b) & gt;> 1) (a + b)/2
The average sum can not beg to shift to the left ((a& (b) + (a ^ b) & gt;> 1)) & lt; <(1) (a + b)/2 * 2
CodePudding user response:
Bit arithmetic used in this place, readability is not good, nor necessary, but you want to study another matter,CodePudding user response:
Should not, moves to the right may be loss of accuracy, the left back may differ,