On Apr 29, 2022, at 12:08:22, Bob Raicer wrote:
The two's complement of the maximum negative number cannot be
represented in the same number of bits. ...
I think you mean "the absolute value (or the positive value)
of the maximum negative number cannot be represented in
the same number of bits." The two's complement of
the maximum negative number is just the maximum negative number:
which can, of course, be represented.
On 2022-04-30 05:10, Paul Gilmartin wrote:
Surely it is possible
to invert all the bits of the maximum negative number, add a value
of one in the rightmost bit position, and *ignore*any*carry* out
of the sign position; the definition of "two's complement" above.
That's exactly what the LCR instruction does.
No it doesn't. RTM. The value in the register is unchanged
in this case.
If you do the calculation you will find that inverting all the bits
and adding one will leave the value in the register unchanged
when the value is the maximum negative number.
--
Martin
Dr Martin Ward | Email: mar...@gkc.org.uk | http://www.gkc.org.uk
G.K.Chesterton site: http://www.gkc.org.uk/gkc | Erdos number: 4