如果一个操作数是无符号整数,另外一个操作数是有符号整数,那么表达式的结果就是无符号整数。
If one of the operands is unsigned and the other is a signed int, the expression becomes an unsigned.
如果我们能够确定其中的一个操作数为unsigned,那么使用无符号除法将会更好,因为它要比有符号除法快得多。
It will be better to use unsigned division by ensuring that one of the operands is unsigned, as this is faster than signed division.
如果在表达式中混合使用无符号和有符号的32位整数,并将其赋值给一个有符号的long类型,那么将其中一个操作数转换成64位的类型。
In cases where unsigned and signed 32-bit integers are mixed in an expression and assigned to a signed long, cast one of the operands to its 64-bit type.
应用推荐