mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
Remove usages of deprecatedWriter
This commit is contained in:
committed by
Andrew Kelley
parent
37ecaae639
commit
de489031d8
@@ -122,7 +122,9 @@ fn mode(comptime x: comptime_int) comptime_int {
|
||||
}
|
||||
|
||||
pub fn main() !void {
|
||||
const stdout = std.fs.File.stdout().deprecatedWriter();
|
||||
var stdout_buffer: [0x100]u8 = undefined;
|
||||
var stdout_writer = std.fs.File.stdout().writer(&stdout_buffer);
|
||||
const stdout = &stdout_writer.interface;
|
||||
|
||||
var buffer: [1024]u8 = undefined;
|
||||
var fixed = std.heap.FixedBufferAllocator.init(buffer[0..]);
|
||||
@@ -139,6 +141,7 @@ pub fn main() !void {
|
||||
while (i < args.len) : (i += 1) {
|
||||
if (std.mem.eql(u8, args[i], "--mode")) {
|
||||
try stdout.print("{}\n", .{builtin.mode});
|
||||
try stdout.flush();
|
||||
return;
|
||||
} else if (std.mem.eql(u8, args[i], "--filter")) {
|
||||
i += 1;
|
||||
@@ -179,6 +182,8 @@ pub fn main() !void {
|
||||
inline for (prngs) |R| {
|
||||
if (filter == null or std.mem.indexOf(u8, R.name, filter.?) != null) {
|
||||
try stdout.print("{s} (long outputs)\n", .{R.name});
|
||||
try stdout.flush();
|
||||
|
||||
const result_long = try benchmark(R, count, long_block_size);
|
||||
try stdout.print(" {:5} MiB/s\n", .{result_long.throughput / (1 * MiB)});
|
||||
}
|
||||
@@ -188,6 +193,8 @@ pub fn main() !void {
|
||||
inline for (prngs) |R| {
|
||||
if (filter == null or std.mem.indexOf(u8, R.name, filter.?) != null) {
|
||||
try stdout.print("{s} (short outputs)\n", .{R.name});
|
||||
try stdout.flush();
|
||||
|
||||
const result_short = try benchmark(R, count, short_block_size);
|
||||
try stdout.print(" {:5} MiB/s\n", .{result_short.throughput / (1 * MiB)});
|
||||
}
|
||||
@@ -199,6 +206,8 @@ pub fn main() !void {
|
||||
inline for (csprngs) |R| {
|
||||
if (filter == null or std.mem.indexOf(u8, R.name, filter.?) != null) {
|
||||
try stdout.print("{s} (cryptographic, long outputs)\n", .{R.name});
|
||||
try stdout.flush();
|
||||
|
||||
const result_long = try benchmark(R, count, long_block_size);
|
||||
try stdout.print(" {:5} MiB/s\n", .{result_long.throughput / (1 * MiB)});
|
||||
}
|
||||
@@ -208,10 +217,13 @@ pub fn main() !void {
|
||||
inline for (csprngs) |R| {
|
||||
if (filter == null or std.mem.indexOf(u8, R.name, filter.?) != null) {
|
||||
try stdout.print("{s} (cryptographic, short outputs)\n", .{R.name});
|
||||
try stdout.flush();
|
||||
|
||||
const result_short = try benchmark(R, count, short_block_size);
|
||||
try stdout.print(" {:5} MiB/s\n", .{result_short.throughput / (1 * MiB)});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try stdout.flush();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user