1.相加运行
int a = 10;
int b = 5;
a= a+b;
b=a-b;
a=a-b;
2.异或运算
int a = 10;
int b = 5;
a ^= b;
b ^= a;
a ^= b;
3.直接赋值
b = a + (a = b) * 0; 无溢出风险
a = a + b - (b = a); 有溢出风险
1.相加运行
int a = 10;
int b = 5;
a= a+b;
b=a-b;
a=a-b;
2.异或运算
int a = 10;
int b = 5;
a ^= b;
b ^= a;
a ^= b;
3.直接赋值
b = a + (a = b) * 0; 无溢出风险
a = a + b - (b = a); 有溢出风险