SMT solving

Bit-vector

A fixed-width sequence of bits with precisely defined operations.

Definition

Bit-vector

A bit-vector is a value made of a fixed number of bits, interpreted by operations such as extraction, concatenation, addition, and signed or unsigned comparison.

Arithmetic wraps at the chosen width. Eight-bit addition therefore differs from unbounded integer addition when a result exceeds 255.

01

Example

For eight-bit vectors, 255 + 1 equals 0 because the ninth bit is discarded.

02

Important distinction

Signed and unsigned comparisons read the same bit pattern differently and must not be exchanged.

After reading this article, you should be able to

  • Define Bit-vector in the sense used on this site.
  • Compute a small fixed-width operation and identify wraparound.