1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00
* 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:
Ulrich Drepper
2001-01-20 04:33:16 +00:00
parent ec4ae3b891
commit df152cc80e
7 changed files with 454 additions and 11 deletions

View File

@ -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;
}