[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] [bug #18899] atoi and atol do not handle vertical tab
Re: [avr-libc-dev] [bug #18899] atoi and atol do not handle vertical tab properly
Wed, 31 Jan 2007 17:19:48 +1000
On Tuesday 30 January 2007 19:32, Joerg Wunsch wrote:
> As Dmitry K. wrote:
> > Besides there is an opportunity a little to reduce a code.
> I guess you are going to summarize the white space checks as
> if (c == ' ' || (c >= BEL && c <= CR)) ...
> are you?
Yes. And remove a set of surplus comparisons.
In result size of atoi() is decreased from approx. 45 words
to 29 words. Speed is increased only.
> I wonder whether we should care about a *real* ctypes implementation
> some day, i.e. about something that is customizable for different
> (8-bit) locales? In that case, the check should be turned into an
> actual call to isspace() rather than inlining it in the assembly code.
> Some additional 10 CPU cycles don't really count when it comes to
> number conversions.
"10 CPU cycles" not exactly: save/restore + call/ret per *each*
space. Probably, best decision will leave inline a code for the
fixed "C" locale (as now) and to make the ispace() call in case
of another locale at configuration time. I think here already
the infrastructure for usage of "library-per-project" is
> The major reason why I didn't fix that bug immediately myself was that
> I'd like to take this as an occasion to think about a regression test
> again. So ideally, we should:
> . set up a regressoin test, using atoi() as an example
> . add the test pattersn mentioned in the bug report, so the
> regressoin test ought to fail
> . fix the bug
> . see the regression test works now
> Sorry Dmitry, I didn't really have the time to look at your fplib
> regression tests so far. (Besides, I don't agree it is a good idea to
> store them as .tar.bz in CVS, but that's another matter.) Do you
> think your preliminary regression suite could be extended for the
> standard libc as well?
I think it is possible to extend. The test script will be, certainly,
completely rewrited in future, but test units will save. I shall
borrow in it in the nearest weekend.