mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
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.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user