阅读背景:

如何减去两个带环绕或溢出的无符号输入

来源:互联网 

There are two unsigned ints (x and y) that need to be subtracted. x is always larger than y. However, both x and y can wrap around; for example, if they were both bytes, after 0xff comes 0x00. The problem case is if x wraps around, while y does not. Now x appears to be smaller than y. Luckily, x will not wrap around twice (only once is guaranteed). Assuming bytes, x has wrapped and is now 0x2, whereas y has not and is 0xFE. The right answer of x - y is supposed to be 0x4. There are two unsigned ints (x and y) that need




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: