gpt4 book ai didi

binary - 二进制补码; 0FFFFh 正,0FFFFh 负?

转载 作者:行者123 更新时间:2023-12-02 08:50:11 27 4
gpt4 key购买 nike

组装艺术一书中,我复制了这句话:

In the two’s complement system, the H.O. bit of a number is a sign bit. If the H.O. bit is zero, the number is positive; if the H.O. bit is one, the number is negative. Examples:

For 16-bit numbers:

8000h is negative because the H.O. bit is one.

100h is positive because the H.O. bit is zero.

7FFFh is positive.

0FFFFh is negative.

0FFFh is positive.

我不明白最后两个例子。如果将这两个示例转换为二进制,第一个示例将得到 0000 1111 1111 1111 1111,第二个示例将得到 0000 1111 1111 1111。为什么前者是负数,后者是正数?在我看来,两者的最高位都是 0,因此两者都应该是正数。

最佳答案

The reason for the leading 0 on 0FFFFH is to give the assember/compiler a hint that F is part of a number. Not all assemblers require this.

所以负数实际上是FFFFh,所以1111 1111 1111 1111,那么就是负数。

computer-programming-forum.com/46-asm/1b99282efbac3bcf.htm

关于binary - 二进制补码; 0FFFFh 正,0FFFFh 负?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15643332/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com