mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 00:35:10 +00:00
Link formatting workaround to issue
This commit is contained in:
parent
11526b6e9d
commit
948dc7b304
@ -404,9 +404,11 @@ fn formatValue(
|
||||
output: fn (@typeOf(context), []const u8) Errors!void,
|
||||
) Errors!void {
|
||||
if (comptime std.mem.eql(u8, fmt, "B")) {
|
||||
// TODO https://github.com/ziglang/zig/issues/2725
|
||||
if (options.width) |w| return formatBytes(value, w, 1000, context, Errors, output);
|
||||
return formatBytes(value, null, 1000, context, Errors, output);
|
||||
} else if (comptime std.mem.eql(u8, fmt, "Bi")) {
|
||||
// TODO https://github.com/ziglang/zig/issues/2725
|
||||
if (options.width) |w| return formatBytes(value, w, 1024, context, Errors, output);
|
||||
return formatBytes(value, null, 1024, context, Errors, output);
|
||||
}
|
||||
@ -458,6 +460,7 @@ pub fn formatIntValue(
|
||||
@compileError("Unknown format string: '" ++ fmt ++ "'");
|
||||
}
|
||||
|
||||
// TODO https://github.com/ziglang/zig/issues/2725
|
||||
if (options.width) |w| return formatInt(int_value, radix, uppercase, w, context, Errors, output);
|
||||
return formatInt(int_value, radix, uppercase, 0, context, Errors, output);
|
||||
}
|
||||
@ -471,11 +474,13 @@ fn formatFloatValue(
|
||||
output: fn (@typeOf(context), []const u8) Errors!void,
|
||||
) Errors!void {
|
||||
if (fmt.len == 0 or comptime std.mem.eql(u8, fmt, "e")) {
|
||||
// TODO https://github.com/ziglang/zig/issues/2725
|
||||
if (options.precision) |p| return formatFloatScientific(value, p, context, Errors, output);
|
||||
return formatFloatScientific(value, null, context, Errors, output);
|
||||
} else if (comptime std.mem.eql(u8, fmt, "d")) {
|
||||
// TODO https://github.com/ziglang/zig/issues/2725
|
||||
if (options.precision) |p| return formatFloatDecimal(value, p, context, Errors, output);
|
||||
return formatFloatDecimal(value, options.precision, context, Errors, output);
|
||||
return formatFloatDecimal(value, null, context, Errors, output);
|
||||
} else {
|
||||
@compileError("Unknown format string: '" ++ fmt ++ "'");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user