Function addWrap [src]

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

Prototype

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

Parameters

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

Source

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