diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-07-08 17:33:02 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-07-09 09:32:07 -0700 |
| commit | bc2cf0c173465f4e3ac60fe2907dfedd2eebf8eb (patch) | |
| tree | 7a404dc11967aa7d552f9fd727477257dd49ad03 /src | |
| parent | d345a10054caa78d6e697089b0b3ca5b540b2d9c (diff) | |
| download | zig-bc2cf0c173465f4e3ac60fe2907dfedd2eebf8eb.tar.gz zig-bc2cf0c173465f4e3ac60fe2907dfedd2eebf8eb.zip | |
eliminate all uses of std.io.Writer.count except for CBE
Diffstat (limited to 'src')
| -rw-r--r-- | src/arch/x86_64/Encoding.zig | 6 | ||||
| -rw-r--r-- | src/link/Elf/Atom.zig | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/arch/x86_64/Encoding.zig b/src/arch/x86_64/Encoding.zig index 6956b25a3f..9b6f6bac5c 100644 --- a/src/arch/x86_64/Encoding.zig +++ b/src/arch/x86_64/Encoding.zig @@ -1016,8 +1016,8 @@ fn estimateInstructionLength(prefix: Prefix, encoding: Encoding, ops: []const Op // By using a buffer with maximum length of encoded instruction, we can use // the `end` field of the Writer for the count. var buf: [16]u8 = undefined; - var trash = std.io.Writer.discarding(&buf); - inst.encode(&trash, .{ + var trash: std.io.Writer.Discarding = .init(&buf); + inst.encode(&trash.writer, .{ .allow_frame_locs = true, .allow_symbols = true, }) catch { @@ -1027,7 +1027,7 @@ fn estimateInstructionLength(prefix: Prefix, encoding: Encoding, ops: []const Op // (`estimateInstructionLength`) has the wrong function signature. @panic("unexpected failure to encode"); }; - return @intCast(trash.end); + return trash.writer.end; } const mnemonic_to_encodings_map = init: { diff --git a/src/link/Elf/Atom.zig b/src/link/Elf/Atom.zig index 14951e7217..5966bae02c 100644 --- a/src/link/Elf/Atom.zig +++ b/src/link/Elf/Atom.zig @@ -1390,8 +1390,8 @@ const x86_64 = struct { // TODO: hack to force imm32s in the assembler .{ .imm = .s(-129) }, }, t) catch return false; - var trash = std.io.Writer.discarding(&.{}); - inst.encode(&trash, .{}) catch return false; + var trash: std.io.Writer.Discarding = .init(&.{}); + inst.encode(&trash.writer, .{}) catch return false; return true; }, else => return false, |
