summaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/a64l.c4
-rw-r--r--stdlib/l64a.c13
2 files changed, 8 insertions, 9 deletions
diff --git a/stdlib/a64l.c b/stdlib/a64l.c
index 9d462c77f3..d1dd3a9b6b 100644
--- a/stdlib/a64l.c
+++ b/stdlib/a64l.c
@@ -24,7 +24,7 @@ a64l (string)
const char *string;
{
size_t cnt;
- long int result = 0l;
+ unsigned long int result = 0l;
for (cnt = 0; cnt < 6; ++cnt)
{
@@ -50,5 +50,5 @@ a64l (string)
}
}
- return result;
+ return (long int) result;
}
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];