authorgravatar for robin@voetter.nlRobin Voetter <robin@voetter.nl> 2021-10-25 14:00:10+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-10-25 14:00:10+02:00
logdf167af0b626479613732389d91e2b7d13f03dc6
treeb97462b505a267e7d51bbc5681fa07dfb667d5c3
parenta587dd08f86bf8524b9dc405044b9b48a735db18
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Revert 83bdbb2 and a587dd0 (#10028)


2 files changed, 4 insertions(+), 12 deletions(-)

lib/std/math/big/int.zig+4-7
......@@ -18,14 +18,11 @@ const debug_safety = false;
1818/// Returns the number of limbs needed to store `scalar`, which must be a
1919/// primitive integer value.
2020pub 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 }
2724
28 const w_value = std.math.absCast(max_scalar);
25 const w_value = std.math.absCast(scalar);
2926 return @divFloor(@intCast(Limb, math.log2(w_value)), limb_bits) + 1;
3027}
3128
lib/std/math/big/rational.zig-5
......@@ -4,8 +4,6 @@ const math = std.math;
44const mem = std.mem;
55const testing = std.testing;
66const Allocator = mem.Allocator;
7const builtin = @import("builtin");
8const native_arch = builtin.target.cpu.arch;
97
108const Limb = std.math.big.Limb;
119const DoubleLimb = std.math.big.DoubleLimb;
......@@ -539,9 +537,6 @@ test "big.rational set" {
539537}
540538
541539test "big.rational setFloat" {
542 // TODO https://github.com/ziglang/zig/issues/10026
543 if (native_arch == .wasm32) return error.SkipZigTest;
544
545540 var a = try Rational.init(testing.allocator);
546541 defer a.deinit();
547542