0

I am going through Computer Systems: A Programmer's perspective (CS:APP) and I had a doubt in the following practice problem -

enter image description here

enter image description here

Solution to line B - enter image description here


Here the disassembler states in line B -0x58. However, the question mentions that the hex numbers are in two's complement form. AFAIK, the negative numbers in two's complement form are stated with 1 in the most significant bit (bit 31 here). This way, the actual negative two's complement hex representation of -88 should be 0xFFFFFFA8. Why does the disassembler not mention this?

Kumaravel Rajan
  • 131
  • 1
  • 2
  • 10
  • 1
    Is that from the "global edition" of CS:APP 3e? If so, the practice problems were replaced by the publisher with [garbage](https://stackoverflow.com/questions/57998998/csapp-example-uses-idivq-with-two-operands) not written by the original authors. You're correct, offsets like `-0x58` are already in sign/magnitude form, not 8-bit or 32-bit 2's complement. – Peter Cordes Apr 13 '23 at 07:34
  • @PeterCordes I indeed had the 3e global edition. Thanks for pointing out that it was a seriously flawed edition. I'll try to secure the 2nd edition. – Kumaravel Rajan Apr 17 '23 at 21:51
  • 1
    The 3e north-american edition is apparently fine; the publishers just wanted there to be different practice problems in the "global" edition. But they hired incompetent (and probably careless) people to rewrite them without even consulting the authors whose name they were putting on the book. – Peter Cordes Apr 17 '23 at 22:05

0 Answers0