| author | |
| committer | |
| log | df167af0b626479613732389d91e2b7d13f03dc6 |
| tree | b97462b505a267e7d51bbc5681fa07dfb667d5c3 |
| parent | a587dd08f86bf8524b9dc405044b9b48a735db18 |
| signature |
2 files changed, 4 insertions(+), 12 deletions(-)
lib/std/math/big/int.zig+4-7| ... | ... | @@ -18,14 +18,11 @@ const debug_safety = false; |
| 18 | 18 | /// Returns the number of limbs needed to store `scalar`, which must be a |
| 19 | 19 | /// primitive integer value. |
| 20 | 20 | pub fn calcLimbLen(scalar: anytype) usize { |
| 21 | const T = @TypeOf(scalar); | |
| 22 | const max_scalar = switch (@typeInfo(T)) { | |
| 23 | .Int => maxInt(T), | |
| 24 | .ComptimeInt => scalar, | |
| 25 | else => @compileError("parameter must be a primitive integer type"), | |
| 26 | }; | |
| 21 | if (scalar == 0) { | |
| 22 | return 1; | |
| 23 | } | |
| 27 | 24 | |
| 28 | const w_value = std.math.absCast(max_scalar); | |
| 25 | const w_value = std.math.absCast(scalar); | |
| 29 | 26 | return @divFloor(@intCast(Limb, math.log2(w_value)), limb_bits) + 1; |
| 30 | 27 | } |
| 31 | 28 |
lib/std/math/big/rational.zig-5| ... | ... | @@ -4,8 +4,6 @@ const math = std.math; |
| 4 | 4 | const mem = std.mem; |
| 5 | 5 | const testing = std.testing; |
| 6 | 6 | const Allocator = mem.Allocator; |
| 7 | const builtin = @import("builtin"); | |
| 8 | const native_arch = builtin.target.cpu.arch; | |
| 9 | 7 | |
| 10 | 8 | const Limb = std.math.big.Limb; |
| 11 | 9 | const DoubleLimb = std.math.big.DoubleLimb; |
| ... | ... | @@ -539,9 +537,6 @@ test "big.rational set" { |
| 539 | 537 | } |
| 540 | 538 | |
| 541 | 539 | test "big.rational setFloat" { |
| 542 | // TODO https://github.com/ziglang/zig/issues/10026 | |
| 543 | if (native_arch == .wasm32) return error.SkipZigTest; | |
| 544 | ||
| 545 | 540 | var a = try Rational.init(testing.allocator); |
| 546 | 541 | defer a.deinit(); |
| 547 | 542 |