about summary refs log tree commit diff
path: root/stdlib/srand48_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/srand48_r.c')
-rw-r--r--stdlib/srand48_r.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/stdlib/srand48_r.c b/stdlib/srand48_r.c
index 80cc7eb6c8..042c669950 100644
--- a/stdlib/srand48_r.c
+++ b/stdlib/srand48_r.c
@@ -22,22 +22,32 @@
 
 int
 srand48_r (seedval, buffer)
-     long seedval;
+     long int seedval;
      struct drand48_data *buffer;
 {
   /* The standards say we only have 32 bits.  */
-  if (sizeof (long) > 4)
+  if (sizeof (long int) > 4)
     seedval &= 0xffffffffl;
 
-#if (USHRT_MAX == 0xffffU)
+#if USHRT_MAX == 0xffffU
   buffer->X[2] = seedval >> 16;
   buffer->X[1] = seedval & 0xffffl;
   buffer->X[0] = 0x330e;
+
+  buffer->a[2] = 0x5;
+  buffer->a[1] = 0xdeec;
+  buffer->a[0] = 0xe66d;
 #else
   buffer->X[2] = seedval;
   buffer->X[1] = 0x330e0000UL;
   buffer->X[0] = 0;
+
+  buffer->a[2] = 0x5deecUL;
+  buffer->a[1] = 0xe66d0000UL;
+  buffer->a[0] = 0;
 #endif
+  buffer->c = 0xb;
+  buffer->init = 1;
 
   return 0;
 }