Binary code problem

To understand the operation mode of the computer, so it is natural binary code problem must, so I am here to share with you the Central Plains binary code, anti-code, complement, frameshift question:

1. The original code

Original code is the highest value of the sign bit plus representation, such as an 8-bit binary representation:

+1 is represented as 0000 0001

-1 is represented as 1000 0001

The first one is the sign bit, the remaining bits of bit values, so obtained is in the range 8-bit binary

[11111111, 011111111] That is [-127, 127]

2. anti-code

It denotes a counter code is:

  ① anti-code number is positive in itself

  ② negative anti-code is based on its original code, the sign bit unchanged, the rest of you in turn negated

+1 original code: 0000 0001 Anti-code: 0000 0001

-1 original code: 1000 0001 Anti-code: 11111110

3. Complement

Complement expressed as:

  ① complement positive numbers is itself

  ② negative complement is the original code, based on the sign bit unchanged, the rest of you negated, last plus 1 (ie plus 1-minus basis)

+1 original code: 0000 0001 Anti-code: 0000 0001 Complement: 0000 0001

-1 original code: 10000001 inverted: 11111110 Complement: 1111 1111

4. frameshift:

Frameshift represents the simplest, whether it is positive or negative number, the sign bit as long as it can complement negated.

 

Guess you like

Origin www.cnblogs.com/gengshao/p/11547052.html