From: drepper Date: Wed, 29 Oct 1997 20:31:34 +0000 (+0000) Subject: Produce a useful result for n < 0. X-Git-Tag: libc-ud-971029~9 X-Git-Url: http://git.csclub.uwaterloo.ca/?p=kopensolaris-gnu%2Fglibc.git;a=commitdiff_plain;h=8f68e02e36b21ee03c375baa2e1aa12a41812818 Produce a useful result for n < 0. --- diff --git a/stdlib/l64a.c b/stdlib/l64a.c index ba7a910c96..9fbde5d139 100644 --- a/stdlib/l64a.c +++ b/stdlib/l64a.c @@ -36,21 +36,20 @@ char * l64a (n) long int n; { + unsigned long int m = (unsigned long int) n; static char result[7]; int cnt; - if (n <= 0l) - /* The value for N == 0 is defined to be the empty string. When a - negative value is given the result is undefined. We will - return the empty string. */ + if (m == 0l) + /* The value for N == 0 is defined to be the empty string. */ return (char *) ""; result[6] = '\0'; - for (cnt = 5; n > 0; --cnt) + for (cnt = 5; m > 0; --cnt) { - result[cnt] = conv_table[n & 0x3f]; - n >>= 6; + result[cnt] = conv_table[m & 0x3f]; + m >>= 6; } return &result[cnt + 1];