about summary refs log tree commit diff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/drand48-iter.c24
-rw-r--r--stdlib/l64a.c4
-rw-r--r--stdlib/srand48_r.c24
3 files changed, 24 insertions, 28 deletions
diff --git a/stdlib/drand48-iter.c b/stdlib/drand48-iter.c
index b98f4026ea..967c404706 100644
--- a/stdlib/drand48-iter.c
+++ b/stdlib/drand48-iter.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA.  */
 
 #include <errno.h>
 #include <stdlib.h>
+#include <limits.h>
 
 
 /* Global state for non-reentrent functions.  */
@@ -40,18 +41,15 @@ __drand48_iterate (xsubi, buffer)
   /* Initialize buffer, if not yet done.  */
   if (!buffer->init)
     {
-      if (sizeof (unsigned short int) == 2)
-	{
-	  buffer->a[2] = 0x5;
-	  buffer->a[1] = 0xdeec;
-	  buffer->a[0] = 0xe66d;
-	}
-      else
-	{
-	  buffer->a[2] = 0x5deecUL;
-	  buffer->a[1] = 0xe66d0000UL;
-	  buffer->a[0] = 0;
-	}
+#if (USHRT_MAX == 0xffffU)
+      buffer->a[2] = 0x5;
+      buffer->a[1] = 0xdeec;
+      buffer->a[0] = 0xe66d;
+#else
+      buffer->a[2] = 0x5deecUL;
+      buffer->a[1] = 0xe66d0000UL;
+      buffer->a[0] = 0;
+#endif
       buffer->c = 0xb;
       buffer->init = 1;
     }
diff --git a/stdlib/l64a.c b/stdlib/l64a.c
index ac2cb64804..914f0b5ded 100644
--- a/stdlib/l64a.c
+++ b/stdlib/l64a.c
@@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA.  */
 #include <stdlib.h>
 
 /* Conversion table.  */
-static const char conv_tab[64] =
+static const char conv_table[64] =
 {
   '.', '/', '0', '1', '2', '3', '4', '5',
   '6', '7', '8', '9', 'A', 'B', 'C', 'D',
@@ -32,7 +32,7 @@ static const char conv_tab[64] =
   's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
 };
 
-const char *
+char *
 l64a (n)
      long n;
 {
diff --git a/stdlib/srand48_r.c b/stdlib/srand48_r.c
index 8720854249..44cee6ddc1 100644
--- a/stdlib/srand48_r.c
+++ b/stdlib/srand48_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -18,6 +18,7 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
 #include <stdlib.h>
+#include <limits.h>
 
 int
 srand48_r (seedval, buffer)
@@ -28,18 +29,15 @@ srand48_r (seedval, buffer)
   if (sizeof (long) > 4)
     seedval &= 0xffffffffl;
 
-  if (sizeof (unsigned short int) == 2)
-    {
-      buffer->X[2] = seedval >> 16;
-      buffer->X[1] = seedval & 0xffffl;
-      buffer->X[0] = 0x330e;
-    }
-  else
-    {
-      buffer->X[2] = seedval;
-      buffer->X[1] = 0x330e0000UL;
-      buffer->X[0] = 0;
-    }
+#if (USHRT_MAX == 0xffffU)
+  buffer->X[2] = seedval >> 16;
+  buffer->X[1] = seedval & 0xffffl;
+  buffer->X[0] = 0x330e;
+#else
+  buffer->X[2] = seedval;
+  buffer->X[1] = 0x330e0000UL;
+  buffer->X[0] = 0;
+#endif
 
   return 0;
 }