mirror of
https://github.com/ziglang/zig.git
synced 2026-01-25 00:35:20 +00:00
AstGen: optimize ZIR for -1 literal
This commit is contained in:
parent
408a08708f
commit
eefa60e376
@ -8458,7 +8458,14 @@ fn numberLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index, source_node:
|
||||
try astgen.errNoteTok(num_token, "use '-0.0' for a floating-point signed zero", .{}),
|
||||
},
|
||||
),
|
||||
1 => .one,
|
||||
1 => {
|
||||
// Handle the negation here!
|
||||
const result: Zir.Inst.Ref = switch (sign) {
|
||||
.positive => .one,
|
||||
.negative => .negative_one,
|
||||
};
|
||||
return rvalue(gz, ri, result, source_node);
|
||||
},
|
||||
else => try gz.addInt(num),
|
||||
},
|
||||
.big_int => |base| big: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user