From d171279d7965137ac835f2ed6d48517478508eae Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 2 Dec 2022 15:42:20 -0700 Subject: CBE: use a 0 literal instead of `error.@"(no error)"` This saves bytes and is easier to read too. --- src/codegen/c.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/codegen') 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) { -- cgit v1.2.3