Fix negation operation (#108)

This commit is contained in:
antoyo 2021-10-31 14:27:52 -04:00 committed by GitHub
parent 08183f9f2d
commit ebe6f6785c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -623,8 +623,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
}
fn neg(&mut self, a: RValue<'gcc>) -> RValue<'gcc> {
// TODO(antoyo): use new_unary_op()?
self.cx.context.new_rvalue_from_long(a.get_type(), 0) - a
self.cx.context.new_unary_op(None, UnaryOp::Minus, a.get_type(), a)
}
fn fneg(&mut self, a: RValue<'gcc>) -> RValue<'gcc> {