当前位置:网站首页>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, %eaxretIt 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.
边栏推荐
- 利用C#传输Json数据
- Use SourceTree to add SSH public key and clone the code cloud project (note finishing)
- 推荐一些面向 Web 开发者的杀手级网站
- 成为CTO,6个月被老板干死,我损失了1000万
- LeetCode 413.等差数列划分
- TMin - TMin是否产生溢出
- 融云 x N 世界:构建无限用户实时交互的「元宇宙会场」
- After the WeChat developer tool program is developed, no error is reported, but the black screen "recommended collection"
- How bad can a programmer be?
- PHP completes missing dates in date ranges/returns missing dates
猜你喜欢

巧用Prometheus来扩展kubernetes调度器

MySQL 5.5系列安装步骤教程(图解版)

Volatile:JVM 我警告你,我的人你别乱动

如何让button中的内容分两行显示

推荐一些面向 Web 开发者的杀手级网站

Knowledge Bits - How to Write a Project Summary

B40 - 基于STM32单片机的电热蚊香蓝牙控制系统

A51 - 基于STM32的DHT11和LCD显示串口通信仿真

August 9, 2022: Build .NET apps in C# -- use the Visual Studio Code debugger to interactively debug .NET apps (won't, fail)

A40 - 基于51单片机的GSM模块优化设计
随机推荐
无需支付688苹果开发者账号,xcode13打包导出ipa,提供他人进行内测
Sigrity PowerSI Characteristic Impedance and Coupling Simulation
Codeforces Round #808 (Div. 2)||Precipitation
dichotomy
AVL树的插入操作
推荐一些面向 Web 开发者的杀手级网站
Use SourceTree to add SSH public key and clone the code cloud project (note finishing)
B43 - 基于STM32单片机的自动视力检测仪
uniapp 项目搭建
How bad can a programmer be?
yolov5训练并生成rknn模型以及3588平台部署
std::uniform_real_distribution的一个bug引发的服务器崩溃
Leading practice | How the world's largest wine app uses design sprint to innovate the vivino model
快捷键修改typora字体----自制脚本
@AllArgsConstructor and @NoArgsConstructor
聊聊基于docker部署的mysql如何进行数据恢复
margin:auto实现盒子水平垂直居中
uniapp project construction
【1413. 逐步求和得到正数的最小值】
B48 - 基于51单片机的学生管理门禁系统设计