为什么当我们在十六进制数字中有1个MSB时,数字不是负数
我正在学习组装中的加法/减法。我搜索了文章,以查看如何知道十六进制数量是否为负/正面,并在下面看到此页面,从此站点
我的问题是我的问题对于屏幕截图中的左侧示例。我们有1个MSB,但n位仍然是0,我想念什么吗? 在同一PDF的添加部分中也有一个类似的示例,其答案为1e,n位为1。
I'm learning about addition/subtraction in Assembly. I searched for articles to see how to know if a hexadecimal number is negative/positive and saw this page below, from this site
My question is for the left-most example in the screenshot. We have 1 as MSB but N bit is still 0, do I miss something?
There is also a similar example in the addition part of the same pdf which have answer 1E and N bit is 1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MSB并不是数字的二进制表示中最高的位,而是对应于容器中容纳您数字的最高位。
考虑以下示例:
1EH的数字为11110b。
如果我们考虑字节大小容器,则其内容为00011110B。最高位不是设置的,因此数字为正。
如果我们考虑单词大小容器,则其内容为0000000000011110B。最高位不是设置的,因此数字为正。
数字85h为10000101b,二进制为10000101b。
如果我们考虑字节大小容器,则其内容为10000101b。设置最高位,因此数字为负。
如果我们考虑单词大小容器,则其内容为0000000010000101B。最高位不是设置的,因此数字为正。
The MSB is not the highest bit that is ON in the binary representation of the number, but rather corresponds to the highest bit in the container that holds your number.
Consider these examples:
The number 1Eh is 11110b in binary.
If we consider a byte-sized container then its contents is 00011110b. The highest bit is not set, therefore the number is positive.
If we consider a word-sized container then its contents is 0000000000011110b. The highest bit is not set, therefore the number is positive.
The number 85h is 10000101b in binary.
If we consider a byte-sized container then its contents is 10000101b. The highest bit is set, therefore the number is negative.
If we consider a word-sized container then its contents is 0000000010000101b. The highest bit is not set, therefore the number is positive.