diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-12-02 15:42:20 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-12-02 15:42:20 -0700 |
| commit | d171279d7965137ac835f2ed6d48517478508eae (patch) | |
| tree | 921484f7afd0f9519e869a30cbaaa19f311465b5 /src/codegen/c.zig | |
| parent | af4361f57af388238a075b0c8ef5b34e75b73787 (diff) | |
| download | zig-d171279d7965137ac835f2ed6d48517478508eae.tar.gz zig-d171279d7965137ac835f2ed6d48517478508eae.zip | |
CBE: use a 0 literal instead of `error.@"(no error)"`
This saves bytes and is easier to read too.
Diffstat (limited to 'src/codegen/c.zig')
| -rw-r--r-- | src/codegen/c.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index d7aec355e9..e38aedb125 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -1141,8 +1141,10 @@ pub const DeclGen = struct { if (!payload_ty.hasRuntimeBits()) { // We use the error type directly as the type. - const err_val = if (val.errorUnionIsPayload()) Value.initTag(.zero) else val; - return dg.renderValue(writer, error_ty, err_val, location); + if (val.errorUnionIsPayload()) { + return try writer.writeByte('0'); + } + return dg.renderValue(writer, error_ty, val, location); } if (location != .Initializer) { |
