C language - the vernacular to understand the original code, inverse code and complement code

Thank you readers for reading


Original, Inverse and Complement

1. Understand storage types

  1. The data is divided into byte type and font data.
    Byte type data occupies 8 bits. Its original code, inverse code, and complement code are all 8 bits, which means that 0-255
    font data occupies 16 bits. Its original code and inverse code are 8 bits. Code and complement code are 16 bits, representing 0-65535
  2. Then some people will have doubts: 8-bit binary and 16-bit binary are both 1, of course it can represent 255 or 65535, but I can represent -127, -32767. Wait a minute, since we say this, then we must figure out what storage method is, is it unsigned storage or signed storage?
  3. Among the 8 bits, if it is unsigned storage - that is, there is no negative number from 0-255, if it is a signed number, it will occupy a bit by itself, so it is expressed as -127-128.
    So we know that our C language int type is also a signed number when it is not written as unsigned. Its range is -2147483648~+2147483647, and the signed number is 4,294,967,295
  4. So what is the original code storage? When we discuss the original code, we discuss whether it is signed or unsigned

Guess you like

Origin blog.csdn.net/qq_33966310/article/details/126168560