Skip to content

Commit

Permalink
C backend: use ++ instead of += for airMemset
Browse files Browse the repository at this point in the history
It does the same thing but has fewer bytes in the output.
  • Loading branch information
andrewrk committed Apr 25, 2023
1 parent 2c36b9a commit b1306a3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/codegen/c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6261,10 +6261,8 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue {
},
.Many, .C => unreachable,
}
try writer.writeAll("; ");
try writer.writeAll("; ++");
try f.writeCValue(writer, index, .Other);
try writer.writeAll(" += ");
try f.object.dg.renderValue(writer, Type.usize, Value.one, .Other);
try writer.writeAll(") ((");
try f.renderType(writer, elem_ptr_ty);
try writer.writeByte(')');
Expand Down

0 comments on commit b1306a3

Please sign in to comment.