Fixed-width signed integers #
FixedInt width stores a two's-complement integer in exactly width bits. The policy is explicit
in every arithmetic name:
wrapAdd,wrapSub, andwrapMulcompute modulo2^width;- checked operations return
noneon signed overflow; - saturating operations clamp to the signed range.
The wrapping kernels operate directly on BitVec. Checked operations use Lean's signed-overflow
tests. Saturating operations compute the exact Int result, clamp it to the signed range, and
encode it.
A two's-complement integer stored in exactly width bits.
- bits : BitVec width
Complete two's-complement bit pattern.
Instances For
Instances For
Construct a fixed-width integer from the low width bits of a natural number.
Instances For
Extract the unsigned bit pattern.
Instances For
Interpret a word as a signed two's-complement integer.
Instances For
Encode an integer modulo 2^width.
Instances For
Least signed integer representable at width.
Instances For
Greatest signed integer representable at width.
Instances For
Whether an integer lies in the signed range of width bits.
Instances For
Two's-complement addition modulo 2^width.
Instances For
Two's-complement subtraction modulo 2^width.
Instances For
Two's-complement multiplication modulo 2^width.
Instances For
Encode an exact integer, clamping it to the signed range when necessary.
Instances For
Signed addition with saturation at the destination bounds.
Instances For
Signed subtraction with saturation at the destination bounds.
Instances For
Signed multiplication with saturation at the destination bounds.