(-1) *(-1)用`imulq`设置``标志''的乘法了吗?

发布于 2025-01-30 19:28:55 字数 437 浏览 3 评论 0原文

考虑使用imulq将两个签名变量乘以值-1

手册指出:“当签名的Intermendiate Intermendiate Interiate Integer值时,将设置CF和标志产品与符号扩展操作数大小截断的产品不同,否则CF和标志将被清除。”

现在,-1的二进制2的补充表示形式是全部字符串,因此(-1)*( - 1)将产生一个看起来像(1 ... 10 0 ..的字符串) .01),因此截短结果的符号出口与整个结果的不同之处。

这是否意味着将设置国旗?这确实令人困惑,因为从直觉上讲,这里没有真正的溢出。

Consider multiplying two signed variables with the value -1 using imulq.

The manual states: "The CF and OF flags are set when the signed integer value of the intermediate product differs from the sign extended operand-size-truncated product, otherwise the CF and OF flags are cleared."

Now, the binary 2's complement representation of -1 is the all-ones string, so (-1)*(-1) would yield a string that looks like (1...10 0...01), so the sign exension of the truncated result differs from the full one.

Does that mean that the OF flag will be set? This is really confusing, becuase intuitively there's no real overflow here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文