about summary refs log tree commit diff
path: root/stdlib/random_r.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /stdlib/random_r.c
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
downloadglibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz
glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.xz
glibc-a334319f6530564d22e775935d9c91663623a1b4.zip
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'stdlib/random_r.c')
-rw-r--r--stdlib/random_r.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/stdlib/random_r.c b/stdlib/random_r.c
index 5e564a737d..09677e6077 100644
--- a/stdlib/random_r.c
+++ b/stdlib/random_r.c
@@ -1,5 +1,5 @@
-/*
-   Copyright (C) 1995, 2005 Free Software Foundation
+/* 
+   Copyright (C) 1995 Free Software Foundation
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -32,7 +32,7 @@
    4. Neither the name of the University nor the names of its contributors
       may be used to endorse or promote products derived from this software
       without specific prior written permission.
-
+   
    THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -236,20 +236,14 @@ __initstate_r (seed, arg_state, n, buf)
      size_t n;
      struct random_data *buf;
 {
+  int type;
+  int degree;
+  int separation;
+  int32_t *state;
+
   if (buf == NULL)
     goto fail;
 
-  int32_t *old_state = buf->state;
-  if (old_state != NULL)
-    {
-      int old_type = buf->rand_type;
-      if (old_type == TYPE_0)
-	old_state[-1] = TYPE_0;
-      else
-	old_state[-1] = (MAX_TYPES * (buf->rptr - old_state)) + old_type;
-    }
-
-  int type;
   if (n >= BREAK_3)
     type = n < BREAK_4 ? TYPE_3 : TYPE_4;
   else if (n < BREAK_1)
@@ -264,13 +258,13 @@ __initstate_r (seed, arg_state, n, buf)
   else
     type = n < BREAK_2 ? TYPE_1 : TYPE_2;
 
-  int degree = random_poly_info.degrees[type];
-  int separation = random_poly_info.seps[type];
+  degree = random_poly_info.degrees[type];
+  separation = random_poly_info.seps[type];
 
   buf->rand_type = type;
   buf->rand_sep = separation;
   buf->rand_deg = degree;
-  int32_t *state = &((int32_t *) arg_state)[1];	/* First location.  */
+  state = &((int32_t *) arg_state)[1];	/* First location.  */
   /* Must set END_PTR before srandom.  */
   buf->end_ptr = &state[degree];