Revert 83bdbb2 and a587dd0 (#10028)

This commit is contained in:
Robin Voetter 2021-10-25 14:00:10 +02:00 committed by GitHub
parent a587dd08f8
commit df167af0b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 12 deletions

View File

@ -18,14 +18,11 @@ const debug_safety = false;
/// Returns the number of limbs needed to store `scalar`, which must be a
/// primitive integer value.
pub fn calcLimbLen(scalar: anytype) usize {
const T = @TypeOf(scalar);
const max_scalar = switch (@typeInfo(T)) {
.Int => maxInt(T),
.ComptimeInt => scalar,
else => @compileError("parameter must be a primitive integer type"),
};
if (scalar == 0) {
return 1;
}
const w_value = std.math.absCast(max_scalar);
const w_value = std.math.absCast(scalar);
return @divFloor(@intCast(Limb, math.log2(w_value)), limb_bits) + 1;
}

View File

@ -4,8 +4,6 @@ const math = std.math;
const mem = std.mem;
const testing = std.testing;
const Allocator = mem.Allocator;
const builtin = @import("builtin");
const native_arch = builtin.target.cpu.arch;
const Limb = std.math.big.Limb;
const DoubleLimb = std.math.big.DoubleLimb;
@ -539,9 +537,6 @@ test "big.rational set" {
}
test "big.rational setFloat" {
// TODO https://github.com/ziglang/zig/issues/10026
if (native_arch == .wasm32) return error.SkipZigTest;
var a = try Rational.init(testing.allocator);
defer a.deinit();