From df152cc80e60dc8bf7167a62ee26cb19a9a675d3 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 20 Jan 2001 04:33:16 +0000 Subject: Update. * stdlib/jrand48_r.c (__jrand48_r): Correct constructing of results. Reported by Jeff Higham . * stdlib/tst-rand48.c: New file. * stdlib/Makefile (tests): Add tst-rand48. --- stdlib/jrand48_r.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'stdlib/jrand48_r.c') diff --git a/stdlib/jrand48_r.c b/stdlib/jrand48_r.c index 95f3ec6..48def5e 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 , 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; } -- cgit v1.1