[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I create a 64-bit integer constant?



On Tue, 2015-06-16 at 22:51 +0100, Dibyendu Majumdar wrote:
> On 16 June 2015 at 22:33, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
> > I can see API functions for int and long but not long long.
> >
> 
> Ok I think I got it - I just need to set the type when calling
> gcc_jit_context_new_rvalue_from_int().

Yes: something like:

   gcc_jit_type *t_long_long =
     gcc_jit_context_get_type (ctxt,
	                        GCC_JIT_TYPE_LONG_LONG);

   gcc_jit_rvalue *val =
      gcc_jit_context_new_rvalue_from_long (ctxt,
                                            t_long_long,
	                                     42);

provided that the constant fits within a "long".  If it doesn't, you'll
need to build it up "by hand" (if that's an issue, let me know, so that
we can extend the API).

Dave