Operation refinements for fixed-width signed integers #
Fixed-width arithmetic has three useful policies: wrapping returns centered modular arithmetic, checked arithmetic returns a result only when the exact integer is representable, and saturating arithmetic clamps at the signed endpoints.
This module exposes all three through the same generic Operation contracts used by the rest of
the library. Algorithms can therefore state the policy they require without depending on
BitVec internals, while execution still uses the compact two's-complement carrier.
Wrapping addition refines centered reduction modulo 2 ^ width.
Wrapping subtraction refines centered reduction modulo 2 ^ width.
Wrapping multiplication refines centered reduction modulo 2 ^ width.
Checked addition returns the exact sum whenever it is representable.
Checked subtraction returns the exact difference whenever it is representable.
Checked multiplication returns the exact product whenever it is representable.
Saturating addition refines exact addition followed by signed-range clamping.
Saturating subtraction refines exact subtraction followed by signed-range clamping.
Saturating multiplication refines exact multiplication followed by signed-range clamping.