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

Re: pp_add -> pp_i_add efficiency hack?

Thread Previous | Thread Next
From:
Gurusamy Sarathy
Date:
October 8, 2000 09:54
Subject:
Re: pp_add -> pp_i_add efficiency hack?
Message ID:
200010081655.JAA05780@smtp3.ActiveState.com
On Sun, 08 Oct 2000 16:09:58 BST, Nick Ing-Simmons wrote:
>Gurusamy Sarathy <gsar@ActiveState.com> 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.)


Sarathy
gsar@ActiveState.com

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About