mirror of
https://github.com/ziglang/zig.git
synced 2024-11-27 07:32:44 +00:00
remove stage1 workaround for big int set
Underlying fix should have been d7b029995c
.
u128 limb sizes are still not fully tested as we are missing compiler-rt
support (__divei4, __modei4 on x86_64). Should be no zig blockers so the
assertion has been removed.
This commit is contained in:
parent
c9b957c937
commit
4009e0d2b1
@ -13,7 +13,6 @@ pub const Log2Limb = std.math.Log2Int(Limb);
|
|||||||
|
|
||||||
comptime {
|
comptime {
|
||||||
assert(std.math.floorPowerOfTwo(usize, limb_info.bits) == limb_info.bits);
|
assert(std.math.floorPowerOfTwo(usize, limb_info.bits) == limb_info.bits);
|
||||||
assert(limb_info.bits <= 64); // u128 set is unsupported
|
|
||||||
assert(limb_info.signedness == .unsigned);
|
assert(limb_info.signedness == .unsigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ pub fn calcLimbLen(scalar: anytype) usize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const w_value = std.math.absCast(scalar);
|
const w_value = std.math.absCast(scalar);
|
||||||
return @divFloor(@intCast(Limb, math.log2(w_value)), limb_bits) + 1;
|
return @intCast(usize, @divFloor(@intCast(Limb, math.log2(w_value)), limb_bits) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn calcToStringLimbsBufferLen(a_len: usize, base: u8) usize {
|
pub fn calcToStringLimbsBufferLen(a_len: usize, base: u8) usize {
|
||||||
@ -238,10 +238,7 @@ pub const Mutable = struct {
|
|||||||
var i: usize = 0;
|
var i: usize = 0;
|
||||||
while (true) : (i += 1) {
|
while (true) : (i += 1) {
|
||||||
self.limbs[i] = @truncate(Limb, w_value);
|
self.limbs[i] = @truncate(Limb, w_value);
|
||||||
|
w_value >>= limb_bits;
|
||||||
// TODO: shift == 64 at compile-time fails. Fails on u128 limbs.
|
|
||||||
w_value >>= limb_bits / 2;
|
|
||||||
w_value >>= limb_bits / 2;
|
|
||||||
|
|
||||||
if (w_value == 0) break;
|
if (w_value == 0) break;
|
||||||
}
|
}
|
||||||
@ -258,9 +255,7 @@ pub const Mutable = struct {
|
|||||||
comptime var i = 0;
|
comptime var i = 0;
|
||||||
inline while (true) : (i += 1) {
|
inline while (true) : (i += 1) {
|
||||||
self.limbs[i] = w_value & mask;
|
self.limbs[i] = w_value & mask;
|
||||||
|
w_value >>= limb_bits;
|
||||||
w_value >>= limb_bits / 2;
|
|
||||||
w_value >>= limb_bits / 2;
|
|
||||||
|
|
||||||
if (w_value == 0) break;
|
if (w_value == 0) break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user