I’m in a computer systems course and have been struggling, in part, with Two’s Complement. I want to understand it but everything I’ve read hasn’t brought the picture together for me. I’ve read the wikipedia article and various other articles, including my text book.
Hence, I wanted to start this community wiki post to define what Two’s Complement is, how to use it and how it can affect numbers during operations like casts (from signed to unsigned and vice versa), bit-wise operations and bit-shift operations.
What I’m hoping for is a clear and concise definition that is easily understood by a programmer.