Files
G4G0-1/Semester 1/Computer Systems Internals & Linux/Week 3/Week 3 Computer Systems Internals.md
2024-01-15 20:14:10 +00:00

1.2 KiB

Lecture 1 (12:00) - Twos Compliment

  • First field becomes -128
  • Overflow happens when:
    • Both numbers are positive or negative
    • Sign is different to sign of input
-128 64 32 16 8 4 2 1 Output
0 0 0 0 1 0 1 0 10
1 1 1 1 0 1 0 1 Invert
1 1
1 Overflow
1 1 1 1 0 1 1 0 -10

-10x10 = -10 x (8+2) = (-10 x 8) + (-10 x 2)

-128 64 32 16 8 4 2 1
1 1 1 1 0 1 1 0 -10
1 0 1 1 0 0 0 0 <<<
1 1 1 1 0 1 1 0 -10
1 1 1 0 1 1 0 0 <
1 0 1 1 0 0 0 0 -80
1 1 1 0 1 1 0 0 -20
1 1 Overflow
1 0 0 1 1 1 0 0 -100