当前位置:网站首页>TMin - whether TMin overflows
TMin - whether TMin overflows
2022-08-09 18:38:00 【leehyukshuai】
At first consider the principle of two's complement subtraction: a − t b = a +t ( − t b ) a-^tb=a+^t(-^tb) a−tb=
But when learning the setl
instruction, the book says that setb
is judged according to SF^OF
, so I think, cmpl $0x80000000, $0x80000000
(ie operation $0x80000000 - $0x80000000
), OF=1, SF=0, then the result of setb
should beis 1, so you get the paradox $0x80000000 < $0x80000000
.
I struggled for a long time until I actually typed the assembly code:
get_OFxorSF:movl %ecx, %eaxsubl %edx, %eaxsetl %almovzbq %al, %eaxretget_SF:movl %ecx, %eaxsubl %edx, %eaxsets %almovzbq %al, %eaxret
It turns out that when 0x80000000-0x80000000
, both OF^SF and SF are set to 0.Therefore OF is also 0, ie TMin-TMin does not overflow.
And when I change the subl
of the above command to addl
, the result is: OF^SF is set to 1, SF is set to 0, that is, >TMin+TMin overflowed.
In conclusion, this kind of entanglement is due to insufficient understanding of the definition of overflow. Overflow means that the result obtained by computer calculation is different from the result obtained by simple arithmetic operation.So of course TMin-TMin=0
will not generate overflow.
边栏推荐
- <IDEA 使用小技巧&&常用键联合操作>
- 5G NR Paging 寻呼
- uni-app覆盖组件样式h5生效,微信小程序不生效的问题
- yolov5训练并生成rknn模型以及3588平台部署
- 如何让button中的内容分两行显示
- The Chinese Academy of Sciences slaps Google in the face: ordinary computers catch up with quantum superiority, and can solve calculations that would have taken 10,000 years in a few hours...
- Redis Cache Expiration and Retirement Policy
- B019 - 甲醛甲烷煤气温湿度时间测试仪
- No need to pay for the 688 Apple developer account, xcode13 packaged and exported ipa, and provided others for internal testing
- @AllArgsConstructor and @NoArgsConstructor
猜你喜欢
随机推荐
Installation and use of Lombok plugin in IDEA
ceph2
2022年中国第三方证券APP创新专题分析
B024 – STM32温湿度控制体温检测烟雾报警系统
The use of websocket in uni-app Disconnection, reconnection, heartbeat mechanism
【嵌入式入门篇】嵌入式0基础沉浸式刷题篇1
MySQL索引的B+树到底有多高?
网络——局域网和广域网
A40 - 基于51单片机的GSM模块优化设计
PHP 补全日期区间中缺少的日期/返回缺少的日期
2022-08-09日报:做学术OR去公司 ? 想通这点,治好 AI 打工人的精神内耗
微信开发者工具程序开发好后,不报错,但是黑屏「建议收藏」
1.1、VIFB: A Visible and Infrared Image Fusion Benchmark(一个可见光与红外图像融合Benchmark)文章阅读
CocosCreator accesses WeChat mini-games
B50 - 基于51单片机的儿童成长管理系统
Codeforces Round # 806 (Div. 4) | | precipitation) bloodbath wudaokou
QT工程编译过程学习
SQL抖音面试题:送你一个万能模板,要吗?(重点、每个用户每月连续登录的最大天数)
Use SourceTree to add SSH public key and clone the code cloud project (note finishing)
Collection of DP Optimization Methods