authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-02 15:42:20-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-02 15:42:20-07:00
logd171279d7965137ac835f2ed6d48517478508eae
tree921484f7afd0f9519e869a30cbaaa19f311465b5
parentaf4361f57af388238a075b0c8ef5b34e75b73787

CBE: use a 0 literal instead of `error.@"(no error)"`

This saves bytes and is easier to read too.

1 files changed, 4 insertions(+), 2 deletions(-)

src/codegen/c.zig+4-2
......@@ -1141,8 +1141,10 @@ pub const DeclGen = struct {
11411141
11421142 if (!payload_ty.hasRuntimeBits()) {
11431143 // We use the error type directly as the type.
1144 const err_val = if (val.errorUnionIsPayload()) Value.initTag(.zero) else val;
1145 return dg.renderValue(writer, error_ty, err_val, location);
1144 if (val.errorUnionIsPayload()) {
1145 return try writer.writeByte('0');
1146 }
1147 return dg.renderValue(writer, error_ty, val, location);
11461148 }
11471149
11481150 if (location != .Initializer) {