diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-04-28 21:40:51 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-05-01 06:47:20 -0400 |
| commit | 28729efe2998579fc36a35e5bdab12727ece1e7a (patch) | |
| tree | 56339a095da516a56b72749d3272fadbeb5163eb /lib/std/math/big | |
| parent | 6b0f7de247f3c12281f47f38738e93651d6bf51b (diff) | |
| download | zig-28729efe2998579fc36a35e5bdab12727ece1e7a.tar.gz zig-28729efe2998579fc36a35e5bdab12727ece1e7a.zip | |
ZIR: implement return instruction
Diffstat (limited to 'lib/std/math/big')
| -rw-r--r-- | lib/std/math/big/int.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/math/big/int.zig b/lib/std/math/big/int.zig index 7e46e7e9b4..fb22f6621b 100644 --- a/lib/std/math/big/int.zig +++ b/lib/std/math/big/int.zig @@ -62,6 +62,7 @@ pub const Int = struct { /// Hint: use `calcLimbLen` to figure out how big an array to allocate for `limbs`. pub fn initSetFixed(limbs: []Limb, value: var) Int { + mem.set(Limb, limbs, 0); var s = Int.initFixed(limbs); s.set(value) catch unreachable; return s; @@ -126,11 +127,10 @@ pub const Int = struct { /// sufficient capacity, the exact amount will be allocated. This occurs even if the requested /// capacity is only greater than the current capacity by one limb. pub fn ensureCapacity(self: *Int, capacity: usize) !void { - self.assertWritable(); if (capacity <= self.limbs.len) { return; } - + self.assertWritable(); self.limbs = try self.allocator.?.realloc(self.limbs, capacity); } |
