From 4298bd6e30f8841250f4912fdbda7a4a2230b561 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 1 Dec 2008 11:03:35 +0000 Subject: l64a: shrink by 13 bytes, and -1 reloc --- libc/stdlib/l64a.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'libc/stdlib/l64a.c') 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; } -- cgit v1.2.3