summaryrefslogtreecommitdiffstats
path: root/libc/stdlib/l64a.c
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2008-12-03 14:04:03 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2008-12-03 14:04:03 +0000
commitd5c32667ad11ff38dc46be527266297b38a341d1 (patch)
treeb3ce68f179d97e6e25e5c8e7ace845c4a561322b /libc/stdlib/l64a.c
parent329ef3196b396a70eecd5a4789845d368b488ab7 (diff)
downloaduClibc-alpine-d5c32667ad11ff38dc46be527266297b38a341d1.tar.bz2
uClibc-alpine-d5c32667ad11ff38dc46be527266297b38a341d1.tar.xz
Synch with trunk @ 24242
Step 18: some more synch: hidden_proto, size reduction and signal handling changes.
Diffstat (limited to 'libc/stdlib/l64a.c')
-rw-r--r--libc/stdlib/l64a.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libc/stdlib/l64a.c b/libc/stdlib/l64a.c
index a8b2d551e..5a1dc13a6 100644
--- a/libc/stdlib/l64a.c
+++ b/libc/stdlib/l64a.c
@@ -36,21 +36,21 @@ char * l64a (long int n)
{
unsigned long int m = (unsigned long int) n;
static char result[7];
- int cnt;
+ char *p;
/* The standard says that only 32 bits are used. */
- m &= 0xffffffff;
+ if (sizeof(m) != 4)
+ m &= 0xffffffff;
- if (m == 0ul)
- /* The value for N == 0 is defined to be the empty string. */
- return (char *) "";
-
- for (cnt = 0; m > 0ul; ++cnt)
+ /* The value for N == 0 is defined to be the empty string,
+ * this code provides that as well. */
+ p = result;
+ while (m)
{
- result[cnt] = conv_table[m & 0x3f];
+ *p++ = conv_table[m & 0x3f];
m >>= 6;
}
- result[cnt] = '\0';
+ *p = '\0';
- return result;
+ return p;
}