Back
Close

Rust for Python Developers - Unsigned, Signed Integers and Casting

Shin_O
31.5K views

This story was originally published on Medium

Follow me:

Ones' Complement

The first bit (MSB) is the same as the signed magnitude. It tells a positive by 0 or negative by 1.

The rest of the bits will take the compliment, which means if it is 1 the complement is 0 and if it is 0, then the complement is 1.

4-bit-word-2

The signed ones’ complement has the same problem as the signed magnitude. There are two zeros, 0000 and 1111.

Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io