mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-18 20:40:28 +00:00
Fixes #5026
This commit is contained in:
@@ -222,6 +222,7 @@ gb_internal lbValue lb_emit_unary_arith(lbProcedure *p, TokenKind op, lbValue x,
|
||||
return lb_emit_byte_swap(p, res, type);
|
||||
}
|
||||
|
||||
Type* bt = base_type(type);
|
||||
lbValue res = {};
|
||||
|
||||
switch (op) {
|
||||
@@ -233,6 +234,8 @@ gb_internal lbValue lb_emit_unary_arith(lbProcedure *p, TokenKind op, lbValue x,
|
||||
case Token_Sub: // Number negation
|
||||
if (is_type_integer(x.type)) {
|
||||
res.value = LLVMBuildNeg(p->builder, x.value, "");
|
||||
} else if (op == Token_Sub && bt->kind == Type_Enum && is_type_integer(bt->Enum.base_type)) {
|
||||
res.value = LLVMBuildNeg(p->builder, x.value, "");
|
||||
} else if (is_type_float(x.type)) {
|
||||
res.value = LLVMBuildFNeg(p->builder, x.value, "");
|
||||
} else if (is_type_complex(x.type)) {
|
||||
|
||||
Reference in New Issue
Block a user