2.4.1.9 Type-coercion

C Function: gcc_jit_rvalue * gcc_jit_context_new_cast (gcc_jit_context *ctxt, gcc_jit_location *loc, gcc_jit_rvalue *rvalue, gcc_jit_type *type)

Given an rvalue of T, construct another rvalue of another type.

Currently only a limited set of conversions are possible:

  • int <-> float
  • int <-> bool
  • P* <-> Q*, for pointer types P and Q
C Function: gcc_jit_rvalue * gcc_jit_context_new_bitcast (gcc_jit_context *ctxt, gcc_jit_location *loc, gcc_jit_rvalue *rvalue, gcc_jit_type *type)

Given an rvalue of T, bitcast it to another type, meaning that this will generate a new rvalue by interpreting the bits of rvalue to the layout of type.

The type of rvalue must be the same size as the size of type.

This entrypoint was added in LIBGCCJIT_ABI_21; you can test for its presence using

#ifdef LIBGCCJIT_HAVE_gcc_jit_context_new_bitcast