[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] optimizing strtol()/strtoul()
From: |
Lou Cypher |
Subject: |
Re: [avr-libc-dev] optimizing strtol()/strtoul() |
Date: |
Thu, 18 Sep 2003 11:07:11 +0200 |
Hello,
still on the strtol()/strtoul() possible optimizations, I made a short patch
file that follows this message.
Just another note: seems that directly compiling strtol()/strtoul() I never
succeed getting intermixed C-source/assembly code; I tried the same default
compiler options in WinAVR sample Makefile, or the even simpler
avr-gcc -g -c -Wa,-adhlns=strtoul.lst strtoul.c
without any luck.
All I get in the listing file is assembly code, intermixed with the right C
line numbers, but the C source following each line number *is not* the code
at that line, just broken pieces of the first 50 lines of source, or so.
Note that the same command line works fine with other sources (my code).
Am I wrong with some switches I miss on command line?
Luca Matteini
--- Begin of patch ---
diff -urN avr-libc-0.99.90.20030908.orig/libc/stdlib/strtol.c avr-libc-
0.99.90.20030908/libc/stdlib/strtol.c
--- avr-libc-0.99.90.20030908.orig/libc/stdlib/strtol.c Fri Jul 5 20:38:44
2002
+++ avr-libc-0.99.90.20030908/libc/stdlib/strtol.c Thu Sep 18 08:06:55 2003
@@ -60,7 +60,7 @@
#define cutoff (cut.quot)
#define cutlim ((int) cut.rem)
#endif
- register int neg = 0, any;
+ register signed char neg = 0, any;
/*
* Skip white space and pick up leading +/- sign if any.
@@ -115,7 +115,7 @@
if (isdigit(c))
c -= '0';
else if (isalpha(c))
- c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+ c = (c & ~0x20) - 'A' - 10;
else
break;
if (c >= base)
diff -urN avr-libc-0.99.90.20030908.orig/libc/stdlib/strtoul.c avr-libc-
0.99.90.20030908/libc/stdlib/strtoul.c
--- avr-libc-0.99.90.20030908.orig/libc/stdlib/strtoul.c Fri Jun 13
21:16:32
2003
+++ avr-libc-0.99.90.20030908/libc/stdlib/strtoul.c Thu Sep 18 08:03:06 2003
@@ -53,7 +53,7 @@
register unsigned char c;
register unsigned long cutoff;
register int cutlim;
- register int neg = 0, any;
+ register signed char neg = 0, any;
/*
* See strtol for comments as to the logic used.
@@ -82,7 +82,7 @@
if (isdigit(c))
c -= '0';
else if (isalpha(c))
- c -= isupper(c) ? 'A' - 10 : 'a' - 10;
+ c = (c & ~0x20) - 'A' - 10;
else
break;
if (c >= base)
--- End of patch ---