Function addSat [src]

r = a + b with 2s-complement saturating semantics. r, a and b may be aliases. Returns an error if memory could not be allocated.

Prototype

pub fn addSat(r: *Managed, a: *const Managed, b: *const Managed, signedness: Signedness, bit_count: usize) Allocator.Error!void

Parameters

r: *Manageda: *const Managedb: *const Managedsignedness: Signednessbit_count: usize

Source

pub fn addSat(r: *Managed, a: *const Managed, b: *const Managed, signedness: Signedness, bit_count: usize) Allocator.Error!void { try r.ensureTwosCompCapacity(bit_count); var m = r.toMutable(); m.addSat(a.toConst(), b.toConst(), signedness, bit_count); r.setMetadata(m.positive, m.len); }