about summary refs log tree commit diff
path: root/stdlib/jrand48_r.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-12-19 08:18:18 +0000
committerUlrich Drepper <drepper@redhat.com>2006-12-19 08:18:18 +0000
commit5bcba0ed52c291c1758a8daf24a7ed1680b0330f (patch)
treeb9849ac2cc5f9b4be532e8763710e757afac1eee /stdlib/jrand48_r.c
parent9e1444fc3ddba6efabe467007c1e600f4571687c (diff)
downloadglibc-5bcba0ed52c291c1758a8daf24a7ed1680b0330f.tar.gz
glibc-5bcba0ed52c291c1758a8daf24a7ed1680b0330f.tar.xz
glibc-5bcba0ed52c291c1758a8daf24a7ed1680b0330f.zip
[BZ #3747]
2006-12-18  Jakub Jelinek  <jakub@redhat.com>
	[BZ #3747]
	* stdlib/jrand48_r.c (__jrand48_r): Make sure result is in the
	[-231 .. 231) range.
	* stdlib/tst-rand48.c (main): Fix expected values for 64-bit
	targets.
	* stdlib/tst-rand48-2.c: New test.
	* stdlib/Makefile (tests): Add tst-rand48-2.
Diffstat (limited to 'stdlib/jrand48_r.c')
-rw-r--r--stdlib/jrand48_r.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stdlib/jrand48_r.c b/stdlib/jrand48_r.c
index 2383ae129e..39e8d090a6 100644
--- a/stdlib/jrand48_r.c
+++ b/stdlib/jrand48_r.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997, 1998, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998, 2001, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -30,7 +30,7 @@ __jrand48_r (xsubi, buffer, result)
     return -1;
 
   /* Store the result.  */
-  *result = ((xsubi[2] << 16) | xsubi[1]) & 0xffffffffl;
+  *result = (int32_t) ((xsubi[2] << 16) | xsubi[1]);
 
   return 0;
 }