Skip to content

Commit ebe6f67

Browse files
authored
Fix negation operation (rust-lang#108)
1 parent 08183f9 commit ebe6f67

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/builder.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
623623
}
624624

625625
fn neg(&mut self, a: RValue<'gcc>) -> RValue<'gcc> {
626-
// TODO(antoyo): use new_unary_op()?
627-
self.cx.context.new_rvalue_from_long(a.get_type(), 0) - a
626+
self.cx.context.new_unary_op(None, UnaryOp::Minus, a.get_type(), a)
628627
}
629628

630629
fn fneg(&mut self, a: RValue<'gcc>) -> RValue<'gcc> {

0 commit comments

Comments
 (0)