Python:如何检查加/减两个 8 位整数是否导致进位或借位?

问题描述 投票:0回答:1

我的问题正如标题所说:如何检查加减两个8位整数是否导致进位或借位?

谢谢!

python binary integer add
1个回答
0
投票

进位标志和加法的一般规则是,如果您将两个值 c = a + b 相加,则如果 c < a when everything is treated as an unsigned value. Likewise for c = a - b, the carry flag is set if c > a 则设置进位标志。

© www.soinside.com 2019 - 2024. All rights reserved.