diff options
| author | Marc Tiehuis <marctiehuis@gmail.com> | 2019-04-11 22:54:19 +1200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-11 22:54:19 +1200 |
| commit | b59c65e9864e20ec88ebb0c3e9e9d38d4aa2e1fc (patch) | |
| tree | 462a160ce76c8d7c92766f753adef9e62841415e /src-self-hosted | |
| parent | dff201540f91bb41b44d7f73a11f4082f928cff7 (diff) | |
| parent | 78af62a19a87904193c59f46ac554330ba872564 (diff) | |
| download | zig-b59c65e9864e20ec88ebb0c3e9e9d38d4aa2e1fc.tar.gz zig-b59c65e9864e20ec88ebb0c3e9e9d38d4aa2e1fc.zip | |
Merge pull request #2102 from ziglang/big.int-additions
Add big.Rational type to std
Diffstat (limited to 'src-self-hosted')
| -rw-r--r-- | src-self-hosted/value.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src-self-hosted/value.zig b/src-self-hosted/value.zig index d8c0f7b5c8..f1c7fc0b50 100644 --- a/src-self-hosted/value.zig +++ b/src-self-hosted/value.zig @@ -538,21 +538,21 @@ pub const Value = struct { switch (self.base.typ.id) { Type.Id.Int => { const type_ref = try self.base.typ.getLlvmType(ofile.arena, ofile.context); - if (self.big_int.len == 0) { + if (self.big_int.len() == 0) { return llvm.ConstNull(type_ref); } - const unsigned_val = if (self.big_int.len == 1) blk: { + const unsigned_val = if (self.big_int.len() == 1) blk: { break :blk llvm.ConstInt(type_ref, self.big_int.limbs[0], @boolToInt(false)); } else if (@sizeOf(std.math.big.Limb) == @sizeOf(u64)) blk: { break :blk llvm.ConstIntOfArbitraryPrecision( type_ref, - @intCast(c_uint, self.big_int.len), + @intCast(c_uint, self.big_int.len()), @ptrCast([*]u64, self.big_int.limbs.ptr), ); } else { @compileError("std.math.Big.Int.Limb size does not match LLVM"); }; - return if (self.big_int.positive) unsigned_val else llvm.ConstNeg(unsigned_val); + return if (self.big_int.isPositive()) unsigned_val else llvm.ConstNeg(unsigned_val); }, Type.Id.ComptimeInt => unreachable, else => unreachable, |
