develooper Front page | perl.perl5.porters | Postings from October 2000

Re: pp_add -> pp_i_add efficiency hack?

Thread Previous | Thread Next
Gurusamy Sarathy
October 8, 2000 09:54
Re: pp_add -> pp_i_add efficiency hack?
Message ID:
On Sun, 08 Oct 2000 16:09:58 BST, Nick Ing-Simmons wrote:
>Gurusamy Sarathy <> writes:
>>instead it should cast the IVX to NV and return that.  Among other
>>things, this means making SvNV() do something like this:
>>    #define SvNV(sv) (SvNOK(sv) ? SvNVX(sv)
>>                                : (SvIOK(sv) ? (NV)SvIVX(sv) : sv_2nv(sv)))
>>instead of this:
>>    #define SvNV(sv) (SvNOK(sv) ? SvNVX(sv) : sv_2nv(sv))
>You could do all that inside  sv_2nv() in the 1st instance  
>rather than replicating all the tests everywhere SvNV() occurs.

If we do that, we'll need to have a way to distinguish whether
sv_2nv() is being used in an lvalue or rvalue context, or perhaps
assume the former and introduce a sv_2nv_force().  (I was assuming
that sv_2nv() always forces NVness as it does now, while changing
SvNV() to convert only when necessary.)


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About