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

Re: strtoul (was Re: [PATCH] Fcntl constants speedup)

Thread Previous | Thread Next
Nick Ing-Simmons
December 20, 2000 07:15
Re: strtoul (was Re: [PATCH] Fcntl constants speedup)
Message ID:
Nicholas Clark <> writes:
>> So was I - looks_like_number is doing most of the work already, having it 
>> tally up the digits into an UV as it goes makes a lot of sense to me.
>I'll be even happier if the arm backend optimiser likes the idea of *10
>total ||= total << 2;
>total = new_digit + total << 1;
>as that's 2 machine instructions, 2 clock cycles, whereas *10 is at least
>4 IIRC.

gcc will probably do that for you. I had to beat it over the head 
with a mallet to stop it doing shift+add that on DSPs where * is one cycle.

>> It is less clear that we want the hassle of the NV case.
>I wasn't thinking of the NV case.

Fine - carry on.

>I was thinking something like
>int son_looks_like_number (SV * sv, UV *value);
>that returns flags about what it found out in the int, and the value in
>*value if the pointer is non null, and the value doesn't overflow.
>(flags include "minus", "erk we've overflowed the UV", "saw a decimal point"
>"saw e notation" and "infinity" as now; the UV would return the abs value)

Apart from the name that is okay.
I would be tempted to make it return the bit-pattern rather than the abs
value - but I assume you have your reasons.

Nick Ing-Simmons <>
Via, but not speaking for: Texas Instruments Ltd.

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