📜  C 位整数绝对值 - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:39.449000             🧑  作者: Mango

代码示例1
// Absolute value for integers
int a = -4268;
// mask = a >> 31 -> (mask ^ a) - mask
int abs = ((a >> 31) ^ a) - (a >> 31);