On Tue Sep 09 10:11:09 2014, SALVA wrote:
Show quoted text> On Tue Nov 19 09:42:40 2013, PLICEASE wrote:
> > As indicating in the POD for Math::Int64, I am unhesitating to ask
> > for
> > a sv_setiv stype macro that sets an int64 value (sv_setu64v would be
> > good too) of an existing scalar value (SV*).
>
> (sorry for the long delay in replying, I haven't noticed this report
> until today)
>
> Why do (did?) you need that, are you looking for speed or just
> convenience?
>
> I ask because I could provide a fast but unsafe way to update an SV
> already pointing to a Math::Int64 object or alternatively I could
> provide a safe but slow way to upgrade any SV to a Math::Int64 and
> then set it to the given value.
>
> Actually in the second case, you can just use something like...
>
> void
> sv_seti64(SV *target, int64_t i64) {
> sv_setsv(target, sv_2mortal(newSVi64(i64)));
> }
The main use case I think is replacing the value of an argument to an xsub. I guess I would prefer a safer way, but it might depend on the risks involved in the "unsafe" approach? I think what I ended up doing is more or less what you suggest. This seemed to be missing from your API compared to what is provided by the native XS API.