Commit df167af0b6
Changed files (2)
lib
std
math
lib/std/math/big/int.zig
@@ -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;
}
lib/std/math/big/rational.zig
@@ -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();