Function copy [src]
Copies the value of a Const to an existing Mutable so that they both have the same value.
Asserts the value fits in the limbs buffer.
Prototype
pub fn copy(self: *Mutable, other: Const) void
Parameters
self: *Mutable
other: Const
Source
pub fn copy(self: *Mutable, other: Const) void {
if (self.limbs.ptr != other.limbs.ptr) {
@memcpy(self.limbs[0..other.limbs.len], other.limbs[0..other.limbs.len]);
}
// Normalize before setting `positive` so the `eqlZero` doesn't need to iterate
// over the extra zero limbs.
self.normalize(other.limbs.len);
self.positive = other.positive or other.eqlZero();
}