Doubts about frameshift

Hello, everyone. With regard to the calculation of frameshift, the book has given such a conclusion:
if the machine word length is n and the specified offset is 2 ^ (Nmai 1), then the shift is equal to the reverse of the complement symbol:
for example: the shift of-7 is 01111001 (because the complement of-7 is 11111001)

later I read a blog about calculating floating-point order codes, in which he calculated that the offset of 7 is 10000110 with an offset of 127.
that is, the source code of 7 + offset (000001111111 = 10000110)

clipboard.png

:

clipboard.png

then I want to verify the previous conclusion by calculating the frameshift in the blog (the shift equals the complement symbol is inverted): the original code of
-7 (10000111) + the offset original code (where the offset should be 2 ^ (NMAE 1), that is, the binary form 10000000) = 00000111

the result shows that the result of frameshift symbol inversion is 01111001, while the result calculated by using the method in the blog is 00000111
question: why are the two results different? How on earth should the frameshift be calculated?

the book only says that if the offset is 2n-1, the offset is equal to the complement symbol is reversed, but if the offset is not 2 ^ (nMul 1), then how to calculate the offset of the original code? Baidu"s results are not clear, but also ask the gods to give us some advice, thank you.

C
Jul.08,2021

pay attention to the above: the book is about offsetting the complement of a negative number. That is to say, of -7 is 10000111 , and its complement is 11111001 . Again, it is offset to complement , not source , so the result of frameshift is 01111001 .

and below, when you use the blog method to calculate, you directly offset the source code of -7 , and of course get different results.

The

blog is incorrect, and the addition of both should be a complement. It just so happens that what he calculates is the positive number, the original code is the same as the complement, so the result is correct. And you are calculating a negative number, so naturally you can't get the correct result

.
Menu