pub fn saturate(r: *Mutable, a: Const, signedness: Signedness, bit_count: usize) void r: *Mutablea: Constsignedness: Signednessbit_count: usize2026
2027
2028
2029
2030 pub fn saturate(r: *Mutable, a: Const, signedness: Signedness, bit_count: usize) void {
if (!a.fitsInTwosComp(signedness, bit_count)) {
r.setTwosCompIntLimit(if (r.positive) .max else .min, signedness, bit_count);
}
}
Saturate an integer to a number of bits, following 2s-complement semantics. r may alias a.
Asserts
rhas enough storage to store the result. The upper bound iscalcTwosCompLimbCount(a.len).