mirror of
https://github.com/ziglang/zig.git
synced 2025-12-26 08:03:08 +00:00
compiler: don't use @abs builtin yet
This commit can be used to rebuild zig1.wasm
This commit is contained in:
parent
6a29646a55
commit
21780899eb
@ -37530,7 +37530,7 @@ fn float128IntPartToBigInt(
|
||||
float: f128,
|
||||
) !std.math.big.int.Managed {
|
||||
const is_negative = std.math.signbit(float);
|
||||
const floored = @floor(@abs(float));
|
||||
const floored = @floor(@fabs(float));
|
||||
|
||||
var rational = try std.math.big.Rational.init(arena);
|
||||
defer rational.q.deinit();
|
||||
|
||||
@ -105,7 +105,7 @@ pub const Instruction = struct {
|
||||
try writer.print("{s} ptr [rip", .{@tagName(rip.ptr_size)});
|
||||
if (rip.disp != 0) try writer.print(" {c} 0x{x}", .{
|
||||
@as(u8, if (rip.disp < 0) '-' else '+'),
|
||||
@abs(rip.disp),
|
||||
std.math.absCast(rip.disp),
|
||||
});
|
||||
try writer.writeByte(']');
|
||||
},
|
||||
@ -140,7 +140,7 @@ pub const Instruction = struct {
|
||||
try writer.print(" {c} ", .{@as(u8, if (sib.disp < 0) '-' else '+')})
|
||||
else if (sib.disp < 0)
|
||||
try writer.writeByte('-');
|
||||
try writer.print("0x{x}", .{@abs(sib.disp)});
|
||||
try writer.print("0x{x}", .{std.math.absCast(sib.disp)});
|
||||
any = true;
|
||||
}
|
||||
|
||||
|
||||
@ -1989,7 +1989,7 @@ pub const Value = struct {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const w_value = @abs(scalar);
|
||||
const w_value = @fabs(scalar);
|
||||
return @divFloor(@as(std.math.big.Limb, @intFromFloat(std.math.log2(w_value))), @typeInfo(std.math.big.Limb).Int.bits) + 1;
|
||||
}
|
||||
|
||||
@ -3741,11 +3741,11 @@ pub const Value = struct {
|
||||
.ComptimeFloat, .Float => {
|
||||
const target = mod.getTarget();
|
||||
const storage: InternPool.Key.Float.Storage = switch (ty.floatBits(target)) {
|
||||
16 => .{ .f16 = @abs(val.toFloat(f16, mod)) },
|
||||
32 => .{ .f32 = @abs(val.toFloat(f32, mod)) },
|
||||
64 => .{ .f64 = @abs(val.toFloat(f64, mod)) },
|
||||
80 => .{ .f80 = @abs(val.toFloat(f80, mod)) },
|
||||
128 => .{ .f128 = @abs(val.toFloat(f128, mod)) },
|
||||
16 => .{ .f16 = @fabs(val.toFloat(f16, mod)) },
|
||||
32 => .{ .f32 = @fabs(val.toFloat(f32, mod)) },
|
||||
64 => .{ .f64 = @fabs(val.toFloat(f64, mod)) },
|
||||
80 => .{ .f80 = @fabs(val.toFloat(f80, mod)) },
|
||||
128 => .{ .f128 = @fabs(val.toFloat(f128, mod)) },
|
||||
else => unreachable,
|
||||
};
|
||||
return (try mod.intern(.{ .float = .{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user