authorgravatar for reserveblue@protonmail.comdrew <reserveblue@protonmail.com> 2021-11-14 22:06:12-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-16 16:51:31-07:00
log3896de307888d598cca1baba8e559debc81d2080
treed76a4e20a16d765e4f9d3ed4a920fd89418c1b5a
parent0300ec4ef70f524718d01f0f351d41349465387c

simplify things


1 files changed, 1 insertions(+), 7 deletions(-)

src/codegen/c.zig+1-7
...@@ -342,12 +342,6 @@ pub const DeclGen = struct {...@@ -342,12 +342,6 @@ pub const DeclGen = struct {
342 // to the assigned pointer type. Note this is just a hack to fix warnings from ordered comparisons (<, >, etc)342 // to the assigned pointer type. Note this is just a hack to fix warnings from ordered comparisons (<, >, etc)
343 // between pointers and 0, which is an extension to begin with.343 // between pointers and 0, which is an extension to begin with.
344 .zero => try writer.writeByte('0'),344 .zero => try writer.writeByte('0'),
345 .one => {
346 // int constants like 1 will not cast to the pointer however.
347 try writer.writeAll("((");
348 try dg.renderType(writer, ty);
349 return writer.writeAll(")1)");
350 },
351 .decl_ref => {345 .decl_ref => {
352 const decl = val.castTag(.decl_ref).?.data;346 const decl = val.castTag(.decl_ref).?.data;
353 return dg.renderDeclValue(writer, ty, val, decl);347 return dg.renderDeclValue(writer, ty, val, decl);
...@@ -376,7 +370,7 @@ pub const DeclGen = struct {...@@ -376,7 +370,7 @@ pub const DeclGen = struct {
376 const decl = val.castTag(.extern_fn).?.data;370 const decl = val.castTag(.extern_fn).?.data;
377 try dg.renderDeclName(decl, writer);371 try dg.renderDeclName(decl, writer);
378 },372 },
379 .int_u64 => {373 .int_u64, .one => {
380 try writer.writeAll("((");374 try writer.writeAll("((");
381 try dg.renderType(writer, ty);375 try dg.renderType(writer, ty);
382 try writer.print(")0x{x}u)", .{val.toUnsignedInt()});376 try writer.print(")0x{x}u)", .{val.toUnsignedInt()});