Build a unary operation out of an input rvalue.
Parameter loc
is optional.
This is a thin wrapper around the C API’s gcc_jit_context_new_unary_op() and the available unary operations are documented there.
There are shorter ways to spell the various specific kinds of unary operation:
Negate an arithmetic value; for example:
gccjit::rvalue negpi = ctxt.new_minus (t_double, pi);
builds the equivalent of this C expression:
-pi
Bitwise negation of an integer value (one’s complement); for example:
gccjit::rvalue mask = ctxt.new_bitwise_negate (t_int, a);
builds the equivalent of this C expression:
~a
Logical negation of an arithmetic or pointer value; for example:
gccjit::rvalue guard = ctxt.new_logical_negate (t_bool, cond);
builds the equivalent of this C expression:
!cond
The most concise way to spell them is with overloaded operators: