Nope, I think you've messed up your math there :)

The current version multiplies the number of numeric types seen by two
(because (unportably) most numbers are twice the size of integers).  Yours
does not take that into account. 

-----Original Message-----
From: Pat Eyler
To: [EMAIL PROTECTED]
Sent: 9/19/2001 2:11 PM
Subject: another silly question about Parrot::Opcode

I found one more bit that looks odd to me (again in _load), near the end
of the while loop is this code:

        my $num_i = () = grep {/i/} @params;
        my $num_n = () = grep {/n/} @params;
        $opcode{$name}{RETURN_OFFSET} = 1 + $num_i + $num_n * 2;

which could be reduced to:

        my $numParams = () = grep {/[ni]/} @params;
        $opcode{$name}{RETURN_OFFSET} = 1 + $numParams * 2;

which is (I think) more legible, and (in limited testing) about 30%
faster -- probably not a big deal in something so little used

Is there a reason not to do this?

-pate

Reply via email to