[Webkit-unassigned] [Bug 6252] JavaScript 1.6 Array.lastIndexOf

bugzilla-daemon at opendarwin.org bugzilla-daemon at opendarwin.org
Fri Aug 18 09:13:14 PDT 2006


http://bugzilla.opendarwin.org/show_bug.cgi?id=6252





------- Comment #15 from vladimir.olexa at gmail.com  2006-08-18 09:13 PDT -------
(In reply to comment #14)
> (From update of attachment 10095 [edit])
> +      if ((d + length) < 0)
> +          return jsNumber(-1);
> +      if (d < 0)
> +          d += length;      
> 
> I think it's a shame that this adds length to d twice. How about this instead:
> 
>     if (d < 0) {
>         d += length;      
>         if (d < 0)
>             return jsNumber(-1);
>     }

sounds good. i have a couple of questions about the above statement, however. i
had a similar short version of the if block as you proposed before but at the
end decided to go with my version since in case (d+length) is negative, the
script stops before performing other tests and thus saves an extra operation.
but then again, if it's not less than zero then it adds an expense of an extra
addition comparison so it's kind of 50-50. what do you think? 


-- 
Configure bugmail: http://bugzilla.opendarwin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list