diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-01-20 04:33:16 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-01-20 04:33:16 +0000 |
commit | df152cc80e60dc8bf7167a62ee26cb19a9a675d3 (patch) | |
tree | a21dc460c0bc8d84bc1b83282dbcdb57392e575f /stdlib/jrand48_r.c | |
parent | ec4ae3b891da3b7c0a0938c0b100178207ad2cc3 (diff) | |
download | glibc-df152cc80e60dc8bf7167a62ee26cb19a9a675d3.tar.gz |
Update.
* stdlib/jrand48_r.c (__jrand48_r): Correct constructing of
results. Reported by Jeff Higham <jhigham@algorithmics.com>.
* stdlib/tst-rand48.c: New file.
* stdlib/Makefile (tests): Add tst-rand48.
Diffstat (limited to 'stdlib/jrand48_r.c')
-rw-r--r-- | stdlib/jrand48_r.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/stdlib/jrand48_r.c b/stdlib/jrand48_r.c index 95f3ec62b2..48def5ef35 100644 --- a/stdlib/jrand48_r.c +++ b/stdlib/jrand48_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1997, 1998, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. @@ -31,12 +31,9 @@ __jrand48_r (xsubi, buffer, result) /* Store the result. */ if (sizeof (unsigned short int) == 2) - *result = ((xsubi[2] & 0x7fff) << 16) | xsubi[1]; + *result = (xsubi[2] << 16) | xsubi[1]; else - *result = xsubi[2] & 0x7fffffffl; - - if (xsubi[2] & (1 << (sizeof (xsubi[2]) * 8 - 1))) - *result *= -1; + *result = xsubi[2] & 0xffffffffl; return 0; } |