(-1) *(-1)用`imulq`设置``标志''的乘法了吗?
考虑使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论