File tree 5 files changed +1303
-249
lines changed
5 files changed +1303
-249
lines changed Original file line number Diff line number Diff line change @@ -521,6 +521,7 @@ set(ZIG_STD_FILES
521
521
"math/atanh.zig"
522
522
"math/big.zig"
523
523
"math/big/int.zig"
524
+ "math/big/rational.zig"
524
525
"math/cbrt.zig"
525
526
"math/ceil.zig"
526
527
"math/complex.zig"
Original file line number Diff line number Diff line change @@ -538,21 +538,21 @@ pub const Value = struct {
538
538
switch (self .base .typ .id ) {
539
539
Type .Id .Int = > {
540
540
const type_ref = try self .base .typ .getLlvmType (ofile .arena , ofile .context );
541
- if (self .big_int .len == 0 ) {
541
+ if (self .big_int .len () == 0 ) {
542
542
return llvm .ConstNull (type_ref );
543
543
}
544
- const unsigned_val = if (self .big_int .len == 1 ) blk : {
544
+ const unsigned_val = if (self .big_int .len () == 1 ) blk : {
545
545
break :blk llvm .ConstInt (type_ref , self .big_int .limbs [0 ], @boolToInt (false ));
546
546
} else if (@sizeOf (std .math .big .Limb ) == @sizeOf (u64 )) blk : {
547
547
break :blk llvm .ConstIntOfArbitraryPrecision (
548
548
type_ref ,
549
- @intCast (c_uint , self .big_int .len ),
549
+ @intCast (c_uint , self .big_int .len () ),
550
550
@ptrCast ([* ]u64 , self .big_int .limbs .ptr ),
551
551
);
552
552
} else {
553
553
@compileError ("std.math.Big.Int.Limb size does not match LLVM" );
554
554
};
555
- return if (self .big_int .positive ) unsigned_val else llvm .ConstNeg (unsigned_val );
555
+ return if (self .big_int .isPositive () ) unsigned_val else llvm .ConstNeg (unsigned_val );
556
556
},
557
557
Type .Id .ComptimeInt = > unreachable ,
558
558
else = > unreachable ,
Original file line number Diff line number Diff line change 1
1
pub use @import ("big/int.zig" );
2
+ pub use @import ("big/rational.zig" );
2
3
3
4
test "math.big" {
4
5
_ = @import ("big/int.zig" );
6
+ _ = @import ("big/rational.zig" );
5
7
}
You can’t perform that action at this time.
0 commit comments